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

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

Issue 1318643002: Pass the v8::Context through the willDestroyServiceWorkerContextOnWorkerThread event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/containers/scoped_ptr_map.h" 10 #include "base/containers/scoped_ptr_map.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // TODO(kalman): Make |request_sender| use |context->AddInvalidationObserver|. 431 // TODO(kalman): Make |request_sender| use |context->AddInvalidationObserver|.
432 // In fact |request_sender_| should really be owned by ScriptContext. 432 // In fact |request_sender_| should really be owned by ScriptContext.
433 request_sender_->InvalidateSource(context); 433 request_sender_->InvalidateSource(context);
434 434
435 script_context_set_->Remove(context); 435 script_context_set_->Remove(context);
436 VLOG(1) << "Num tracked contexts: " << script_context_set_->size(); 436 VLOG(1) << "Num tracked contexts: " << script_context_set_->size();
437 } 437 }
438 438
439 // static 439 // static
440 void Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread( 440 void Dispatcher::WillDestroyServiceWorkerContextOnWorkerThread(
441 v8::Local<v8::Context> v8_context,
441 const GURL& url) { 442 const GURL& url) {
442 if (RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(url)) 443 if (RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(url))
443 g_service_worker_script_context_set.Get().Remove(url); 444 g_service_worker_script_context_set.Get().Remove(url);
444 } 445 }
445 446
446 void Dispatcher::DidCreateDocumentElement(blink::WebLocalFrame* frame) { 447 void Dispatcher::DidCreateDocumentElement(blink::WebLocalFrame* frame) {
447 // Note: use GetEffectiveDocumentURL not just frame->document()->url() 448 // Note: use GetEffectiveDocumentURL not just frame->document()->url()
448 // so that this also injects the stylesheet on about:blank frames that 449 // so that this also injects the stylesheet on about:blank frames that
449 // are hosted in the extension process. 450 // are hosted in the extension process.
450 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( 451 GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 void Dispatcher::AddChannelSpecificFeatures() { 1570 void Dispatcher::AddChannelSpecificFeatures() {
1570 // chrome-extension: resources should be allowed to register a Service Worker. 1571 // chrome-extension: resources should be allowed to register a Service Worker.
1571 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) 1572 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker)
1572 ->IsAvailableToEnvironment() 1573 ->IsAvailableToEnvironment()
1573 .is_available()) 1574 .is_available())
1574 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( 1575 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
1575 WebString::fromUTF8(kExtensionScheme)); 1576 WebString::fromUTF8(kExtensionScheme));
1576 } 1577 }
1577 1578
1578 } // namespace extensions 1579 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698