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

Unified Diff: chrome/renderer/extensions/app_window_custom_bindings.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/public/renderer/render_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/app_window_custom_bindings.cc
diff --git a/chrome/renderer/extensions/app_window_custom_bindings.cc b/chrome/renderer/extensions/app_window_custom_bindings.cc
index accaff4ab6066575eef17c5a97747d3240603e29..5385930c176a421ccaed8d12e643006a1561c804 100644
--- a/chrome/renderer/extensions/app_window_custom_bindings.cc
+++ b/chrome/renderer/extensions/app_window_custom_bindings.cc
@@ -60,27 +60,6 @@ AppWindowCustomBindings::AppWindowCustomBindings(Dispatcher* dispatcher)
}
namespace {
-class FindViewByID : public content::RenderViewVisitor {
- public:
- explicit FindViewByID(int route_id) : route_id_(route_id), view_(NULL) {
- }
-
- content::RenderView* view() { return view_; }
-
- // Returns false to terminate the iteration.
- virtual bool Visit(content::RenderView* render_view) {
- if (render_view->GetRoutingID() == route_id_) {
- view_ = render_view;
- return false;
- }
- return true;
- }
-
- private:
- int route_id_;
- content::RenderView* view_;
-};
-
class LoadWatcher : public content::RenderViewObserver {
public:
LoadWatcher(
@@ -134,9 +113,7 @@ v8::Handle<v8::Value> AppWindowCustomBindings::OnContextReady(
int view_id = args[0]->Int32Value();
- FindViewByID view_finder(view_id);
- content::RenderView::ForEach(&view_finder);
- content::RenderView* view = view_finder.view();
+ content::RenderView* view = content::RenderView::FromRoutingID(view_id);
if (!view)
return v8::Undefined();
@@ -166,14 +143,7 @@ v8::Handle<v8::Value> AppWindowCustomBindings::GetView(
if (view_id == MSG_ROUTING_NONE)
return v8::Undefined();
- // TODO(jeremya): there exists a direct map of routing_id -> RenderView as
- // ChildThread::current()->ResolveRoute(), but ResolveRoute returns an
- // IPC::Listener*, which RenderView doesn't inherit from (RenderViewImpl
- // does, indirectly, via RenderWidget, but the link isn't exposed outside of
- // content/.)
- FindViewByID view_finder(view_id);
- content::RenderView::ForEach(&view_finder);
- content::RenderView* view = view_finder.view();
+ content::RenderView* view = content::RenderView::FromRoutingID(view_id);
if (!view)
return v8::Undefined();
« no previous file with comments | « no previous file | content/public/renderer/render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698