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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 1074273002: Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: being process of relanding - more test assertions Created 5 years, 8 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
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 "extensions/renderer/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 void Dispatcher::WillReleaseScriptContext( 359 void Dispatcher::WillReleaseScriptContext(
360 blink::WebLocalFrame* frame, 360 blink::WebLocalFrame* frame,
361 const v8::Handle<v8::Context>& v8_context, 361 const v8::Handle<v8::Context>& v8_context,
362 int world_id) { 362 int world_id) {
363 ScriptContext* context = script_context_set_.GetByV8Context(v8_context); 363 ScriptContext* context = script_context_set_.GetByV8Context(v8_context);
364 if (!context) 364 if (!context)
365 return; 365 return;
366 366
367 context->DispatchOnUnloadEvent(); 367 context->DispatchOnUnloadEvent();
368 // TODO(kalman): add an invalidation observer interface to ScriptContext. 368 // TODO(kalman): Make |request_sender| use |context->AddInvalidationObserver|.
369 // In fact |request_sender_| should really be owned by ScriptContext.
369 request_sender_->InvalidateSource(context); 370 request_sender_->InvalidateSource(context);
370 371
371 script_context_set_.Remove(context); 372 script_context_set_.Remove(context);
372 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); 373 VLOG(1) << "Num tracked contexts: " << script_context_set_.size();
373 } 374 }
374 375
375 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { 376 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) {
376 // Note: use GetEffectiveDocumentURL not just frame->document()->url() 377 // Note: use GetEffectiveDocumentURL not just frame->document()->url()
377 // so that this also injects the stylesheet on about:blank frames that 378 // so that this also injects the stylesheet on about:blank frames that
378 // are hosted in the extension process. 379 // are hosted in the extension process.
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 // The "guestViewDeny" module must always be loaded last. It registers 1561 // The "guestViewDeny" module must always be loaded last. It registers
1561 // error-providing custom elements for the GuestView types that are not 1562 // error-providing custom elements for the GuestView types that are not
1562 // available, and thus all of those types must have been checked and loaded 1563 // available, and thus all of those types must have been checked and loaded
1563 // (or not loaded) beforehand. 1564 // (or not loaded) beforehand.
1564 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1565 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1565 module_system->Require("guestViewDeny"); 1566 module_system->Require("guestViewDeny");
1566 } 1567 }
1567 } 1568 }
1568 1569
1569 } // namespace extensions 1570 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/events_are_unregistered/page2.js ('k') | extensions/renderer/event_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698