Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1164)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 11316160: app.window: Replace linear view search with direct lookup. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: render_view_impl: Changed the FromRoutingID function into static method RenderViewImpl::FromRouting… Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 #if defined(OS_ANDROID) 365 #if defined(OS_ANDROID)
366 // Delay between tapping in content and launching the associated android intent. 366 // Delay between tapping in content and launching the associated android intent.
367 // Used to allow users see what has been recognized as content. 367 // Used to allow users see what has been recognized as content.
368 static const size_t kContentIntentDelayMilliseconds = 700; 368 static const size_t kContentIntentDelayMilliseconds = 700;
369 #endif 369 #endif
370 370
371 static RenderViewImpl* (*g_create_render_view_impl)(RenderViewImplParams*) = 371 static RenderViewImpl* (*g_create_render_view_impl)(RenderViewImplParams*) =
372 NULL; 372 NULL;
373 373
374 static RenderViewImpl* FromRoutingID(int32 routing_id) {
375 RoutingIDViewMap* views = g_routing_id_view_map.Pointer();
376 RoutingIDViewMap::iterator it = views->find(routing_id);
377 return it == views->end() ? NULL : it->second;
378 }
379
380 static WebKit::WebFrame* FindFrameByID(WebKit::WebFrame* root, int frame_id) { 374 static WebKit::WebFrame* FindFrameByID(WebKit::WebFrame* root, int frame_id) {
381 for (WebFrame* frame = root; frame; frame = frame->traverseNext(false)) { 375 for (WebFrame* frame = root; frame; frame = frame->traverseNext(false)) {
382 if (frame->identifier() == frame_id) 376 if (frame->identifier() == frame_id)
383 return frame; 377 return frame;
384 } 378 }
385 return NULL; 379 return NULL;
386 } 380 }
387 381
388 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) { 382 static void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) {
389 // Replace any occurrences of swappedout:// with about:blank. 383 // Replace any occurrences of swappedout:// with about:blank.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 ViewMap::iterator it = views->find(webview); 772 ViewMap::iterator it = views->find(webview);
779 return it == views->end() ? NULL : it->second; 773 return it == views->end() ? NULL : it->second;
780 } 774 }
781 775
782 /*static*/ 776 /*static*/
783 RenderView* RenderView::FromWebView(WebKit::WebView* webview) { 777 RenderView* RenderView::FromWebView(WebKit::WebView* webview) {
784 return RenderViewImpl::FromWebView(webview); 778 return RenderViewImpl::FromWebView(webview);
785 } 779 }
786 780
787 /*static*/ 781 /*static*/
782 RenderViewImpl* RenderViewImpl::FromRoutingID(int32 routing_id) {
783 RoutingIDViewMap* views = g_routing_id_view_map.Pointer();
784 RoutingIDViewMap::iterator it = views->find(routing_id);
785 return it == views->end() ? NULL : it->second;
786 }
787
788 /*static*/
789 RenderView* RenderView::FromRoutingID(int routing_id) {
790 return RenderViewImpl::FromRoutingID(routing_id);
791 }
792
793 /*static*/
788 void RenderView::ForEach(RenderViewVisitor* visitor) { 794 void RenderView::ForEach(RenderViewVisitor* visitor) {
789 ViewMap* views = g_view_map.Pointer(); 795 ViewMap* views = g_view_map.Pointer();
790 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) { 796 for (ViewMap::iterator it = views->begin(); it != views->end(); ++it) {
791 if (!visitor->Visit(it->second)) 797 if (!visitor->Visit(it->second))
792 return; 798 return;
793 } 799 }
794 } 800 }
795 801
796 /*static*/ 802 /*static*/
797 RenderViewImpl* RenderViewImpl::Create( 803 RenderViewImpl* RenderViewImpl::Create(
(...skipping 5640 matching lines...) Expand 10 before | Expand all | Expand 10 after
6438 } 6444 }
6439 #endif 6445 #endif
6440 6446
6441 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6447 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6442 TransportDIB::Handle dib_handle) { 6448 TransportDIB::Handle dib_handle) {
6443 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6449 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6444 RenderProcess::current()->ReleaseTransportDIB(dib); 6450 RenderProcess::current()->ReleaseTransportDIB(dib);
6445 } 6451 }
6446 6452
6447 } // namespace content 6453 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698