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

Side by Side Diff: content/child/service_worker/service_worker_network_provider.cc

Issue 1149383004: [3/5 chromium] Shows the clients which are controlled by ServiceWorker in DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated nhiroki's comment Created 5 years, 6 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 "content/child/service_worker/service_worker_network_provider.h" 5 #include "content/child/service_worker/service_worker_network_provider.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "content/child/child_thread_impl.h" 8 #include "content/child/child_thread_impl.h"
9 #include "content/child/service_worker/service_worker_provider_context.h" 9 #include "content/child/service_worker/service_worker_provider_context.h"
10 #include "content/common/service_worker/service_worker_messages.h" 10 #include "content/common/service_worker/service_worker_messages.h"
(...skipping 18 matching lines...) Expand all
29 datasource_userdata->SetUserData(&kUserDataKey, network_provider.release()); 29 datasource_userdata->SetUserData(&kUserDataKey, network_provider.release());
30 } 30 }
31 31
32 ServiceWorkerNetworkProvider* ServiceWorkerNetworkProvider::FromDocumentState( 32 ServiceWorkerNetworkProvider* ServiceWorkerNetworkProvider::FromDocumentState(
33 base::SupportsUserData* datasource_userdata) { 33 base::SupportsUserData* datasource_userdata) {
34 return static_cast<ServiceWorkerNetworkProvider*>( 34 return static_cast<ServiceWorkerNetworkProvider*>(
35 datasource_userdata->GetUserData(&kUserDataKey)); 35 datasource_userdata->GetUserData(&kUserDataKey));
36 } 36 }
37 37
38 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( 38 ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
39 int render_frame_id, 39 int route_id,
40 ServiceWorkerProviderType provider_type) 40 ServiceWorkerProviderType provider_type)
41 : provider_id_(GetNextProviderId()), 41 : provider_id_(GetNextProviderId()),
42 context_(new ServiceWorkerProviderContext(provider_id_)) { 42 context_(new ServiceWorkerProviderContext(provider_id_)) {
43 if (!ChildThreadImpl::current()) 43 if (!ChildThreadImpl::current())
44 return; // May be null in some tests. 44 return; // May be null in some tests.
45 ChildThreadImpl::current()->Send( 45 ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_ProviderCreated(
46 new ServiceWorkerHostMsg_ProviderCreated( 46 provider_id_, route_id, provider_type));
47 provider_id_, render_frame_id, provider_type));
48 } 47 }
49 48
50 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() { 49 ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() {
51 if (!ChildThreadImpl::current()) 50 if (!ChildThreadImpl::current())
52 return; // May be null in some tests. 51 return; // May be null in some tests.
53 ChildThreadImpl::current()->Send( 52 ChildThreadImpl::current()->Send(
54 new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_)); 53 new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_));
55 } 54 }
56 55
57 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId( 56 void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId(
58 int64 version_id) { 57 int64 version_id) {
59 if (!ChildThreadImpl::current()) 58 if (!ChildThreadImpl::current())
60 return; // May be null in some tests. 59 return; // May be null in some tests.
61 ChildThreadImpl::current()->Send( 60 ChildThreadImpl::current()->Send(
62 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id)); 61 new ServiceWorkerHostMsg_SetVersionId(provider_id_, version_id));
63 } 62 }
64 63
65 } // namespace content 64 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698