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

Unified Diff: content/renderer/web_ui_mojo.h

Issue 215373004: Makes mojo WebUI run main only after page finishes loading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename DidFinishDocumentLoad so it doesn't conflict with RVO Created 6 years, 9 months 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 | « content/browser/renderer_host/render_process_host_mojo_impl.h ('k') | content/renderer/web_ui_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_mojo.h
diff --git a/content/renderer/web_ui_mojo.h b/content/renderer/web_ui_mojo.h
index 486132f101dcae3bc6ca8e835030e5cd892585a0..d9a7f008a7a62c85b00d5a47f25c4c5f7f6d13c1 100644
--- a/content/renderer/web_ui_mojo.h
+++ b/content/renderer/web_ui_mojo.h
@@ -42,6 +42,7 @@ class WebUIMojo
// RenderFrameObserver overrides:
virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context,
int world_id) OVERRIDE;
+ virtual void DidFinishDocumentLoad() OVERRIDE;
private:
WebUIMojo* web_ui_mojo_;
@@ -54,6 +55,13 @@ class WebUIMojo
void CreateContextState();
void DestroyContextState(v8::Handle<v8::Context> context);
+ // Invoked when the frame finishes loading. Invokes SetHandleOnContextState()
+ // if necessary.
+ void OnDidFinishDocumentLoad();
+
+ // Invokes SetHandle() on the WebUIMojoContextState (if there is one).
+ void SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle);
+
WebUIMojoContextState* GetContextState();
// RenderViewObserver overrides:
@@ -62,6 +70,16 @@ class WebUIMojo
MainFrameObserver main_frame_observer_;
+ // Set to true in DidFinishDocumentLoad(). 'main' is only executed once this
+ // happens.
+ bool did_finish_document_load_;
+
+ // If SetBrowserHandle() is invoked before the document finishes loading the
+ // MessagePipeHandle is stored here. When the document finishes loading
+ // SetHandleOnContextState() is invoked to send the handle to the
+ // WebUIMojoContextState and ultimately the page.
+ mojo::ScopedMessagePipeHandle pending_handle_;
+
DISALLOW_COPY_AND_ASSIGN(WebUIMojo);
};
« no previous file with comments | « content/browser/renderer_host/render_process_host_mojo_impl.h ('k') | content/renderer/web_ui_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698