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

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

Issue 1137533002: MainFrameObserver is inline owned, so it shouldn't be freed by OnDestruct (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments by sky@. Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « content/renderer/web_ui_mojo.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web_ui_mojo.h" 5 #include "content/renderer/web_ui_mojo.h"
6 6
7 #include "content/common/view_messages.h" 7 #include "content/common/view_messages.h"
8 #include "content/public/renderer/render_frame.h" 8 #include "content/public/renderer/render_frame.h"
9 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
10 #include "content/renderer/web_ui_mojo_context_state.h" 10 #include "content/renderer/web_ui_mojo_context_state.h"
(...skipping 27 matching lines...) Expand all
38 void WebUIMojo::MainFrameObserver::WillReleaseScriptContext( 38 void WebUIMojo::MainFrameObserver::WillReleaseScriptContext(
39 v8::Local<v8::Context> context, 39 v8::Local<v8::Context> context,
40 int world_id) { 40 int world_id) {
41 web_ui_mojo_->DestroyContextState(context); 41 web_ui_mojo_->DestroyContextState(context);
42 } 42 }
43 43
44 void WebUIMojo::MainFrameObserver::DidFinishDocumentLoad() { 44 void WebUIMojo::MainFrameObserver::DidFinishDocumentLoad() {
45 web_ui_mojo_->OnDidFinishDocumentLoad(); 45 web_ui_mojo_->OnDidFinishDocumentLoad();
46 } 46 }
47 47
48 void WebUIMojo::MainFrameObserver::OnDestruct() {
49 }
50
48 WebUIMojo::WebUIMojo(RenderView* render_view) 51 WebUIMojo::WebUIMojo(RenderView* render_view)
49 : RenderViewObserver(render_view), 52 : RenderViewObserver(render_view),
50 RenderViewObserverTracker<WebUIMojo>(render_view), 53 RenderViewObserverTracker<WebUIMojo>(render_view),
51 main_frame_observer_(this) { 54 main_frame_observer_(this) {
52 } 55 }
53 56
54 WebUIMojo::~WebUIMojo() { 57 WebUIMojo::~WebUIMojo() {
55 } 58 }
56 59
57 void WebUIMojo::CreateContextState() { 60 void WebUIMojo::CreateContextState() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // be empty and we don't need to destroy it. 114 // be empty and we don't need to destroy it.
112 WebUIMojoContextState* state = GetContextState(); 115 WebUIMojoContextState* state = GetContextState();
113 if (state && !state->module_added()) 116 if (state && !state->module_added())
114 return; 117 return;
115 118
116 v8::HandleScope handle_scope(blink::mainThreadIsolate()); 119 v8::HandleScope handle_scope(blink::mainThreadIsolate());
117 DestroyContextState(frame->mainWorldScriptContext()); 120 DestroyContextState(frame->mainWorldScriptContext());
118 } 121 }
119 122
120 } // namespace content 123 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/web_ui_mojo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698