Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/devtools/protocol/service_worker_handler.h" | 5 #include "content/browser/devtools/protocol/service_worker_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/scoped_ptr_hash_map.h" | |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 10 #include "content/browser/devtools/service_worker_devtools_agent_host.h" |
| 10 #include "content/browser/devtools/service_worker_devtools_manager.h" | 11 #include "content/browser/devtools/service_worker_devtools_manager.h" |
| 11 #include "content/browser/service_worker/service_worker_context_observer.h" | 12 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 13 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 14 #include "content/browser/service_worker/service_worker_version.h" | |
| 13 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/devtools_agent_host.h" | 17 #include "content/public/browser/devtools_agent_host.h" |
| 16 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
| 17 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/storage_partition.h" | 20 #include "content/public/browser/storage_partition.h" |
| 19 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 20 | 22 |
| 21 // Windows headers will redefine SendMessage. | 23 // Windows headers will redefine SendMessage. |
| 22 #ifdef SendMessage | 24 #ifdef SendMessage |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 ->set_status(GetVersionStatusString(version_info.status))); | 78 ->set_status(GetVersionStatusString(version_info.status))); |
| 77 return version; | 79 return version; |
| 78 } | 80 } |
| 79 | 81 |
| 80 scoped_refptr<ServiceWorkerRegistration> CreateRegistrationDictionaryValue( | 82 scoped_refptr<ServiceWorkerRegistration> CreateRegistrationDictionaryValue( |
| 81 const ServiceWorkerRegistrationInfo& registration_info) { | 83 const ServiceWorkerRegistrationInfo& registration_info) { |
| 82 scoped_refptr<ServiceWorkerRegistration> registration( | 84 scoped_refptr<ServiceWorkerRegistration> registration( |
| 83 ServiceWorkerRegistration::Create() | 85 ServiceWorkerRegistration::Create() |
| 84 ->set_registration_id( | 86 ->set_registration_id( |
| 85 base::Int64ToString(registration_info.registration_id)) | 87 base::Int64ToString(registration_info.registration_id)) |
| 86 ->set_scope_url(registration_info.pattern.spec())); | 88 ->set_scope_url(registration_info.pattern.spec()) |
| 87 if (registration_info.active_version.version_id != | 89 ->set_is_deleted(registration_info.is_deleted)); |
| 88 kInvalidServiceWorkerVersionId) { | |
| 89 registration->set_active_version( | |
| 90 CreateVersionDictionaryValue(registration_info.active_version)); | |
| 91 } | |
| 92 if (registration_info.waiting_version.version_id != | |
| 93 kInvalidServiceWorkerVersionId) { | |
| 94 registration->set_waiting_version( | |
| 95 CreateVersionDictionaryValue(registration_info.waiting_version)); | |
| 96 } | |
| 97 if (registration_info.installing_version.version_id != | |
| 98 kInvalidServiceWorkerVersionId) { | |
| 99 registration->set_installing_version( | |
| 100 CreateVersionDictionaryValue(registration_info.installing_version)); | |
| 101 } | |
| 102 return registration; | 90 return registration; |
| 103 } | 91 } |
| 104 | 92 |
| 105 } // namespace | 93 } // namespace |
| 106 | 94 |
| 107 using Response = DevToolsProtocolClient::Response; | 95 using Response = DevToolsProtocolClient::Response; |
| 108 | 96 |
| 109 class ServiceWorkerHandler::ContextObserver | 97 class ServiceWorkerHandler::ContextObserver |
| 110 : public ServiceWorkerContextObserver, | 98 : public ServiceWorkerContextObserver, |
| 111 public base::RefCountedThreadSafe<ContextObserver> { | 99 public base::RefCountedThreadSafe<ContextObserver> { |
| 112 public: | 100 public: |
| 113 ContextObserver(scoped_refptr<ServiceWorkerContextWrapper> context, | 101 ContextObserver(scoped_refptr<ServiceWorkerContextWrapper> context, |
| 114 base::WeakPtr<ServiceWorkerHandler> handler); | 102 base::WeakPtr<ServiceWorkerHandler> handler); |
| 115 void Start(); | 103 void Start(); |
| 116 void Stop(); | 104 void Stop(); |
| 117 | 105 |
| 118 private: | 106 private: |
| 119 friend class base::RefCountedThreadSafe<ContextObserver>; | 107 friend class base::RefCountedThreadSafe<ContextObserver>; |
| 120 ~ContextObserver() override; | 108 ~ContextObserver() override; |
| 121 void GetStoredRegistrationsOnIOThread(); | 109 void GetStoredRegistrationsOnIOThread(); |
| 122 void OnStoredRegistrationsOnIOThread( | 110 void OnStoredRegistrationsOnIOThread( |
| 123 const std::vector<ServiceWorkerRegistrationInfo>& registrations); | 111 const std::vector<ServiceWorkerRegistrationInfo>& stored_registrations); |
| 124 void StopOnIOThread(); | 112 void StopOnIOThread(); |
| 125 | 113 |
| 126 void OnVersionUpdated(int64 version_id); | 114 void StoreRegistrationInfo(const ServiceWorkerRegistrationInfo& registration); |
| 127 void OnRegistrationUpdated(int64 registration_id); | 115 void StoreVersionInfo(const ServiceWorkerVersionInfo& version); |
| 116 | |
| 117 void SendRegistrationInfo(const ServiceWorkerRegistrationInfo& registration); | |
| 118 void SendVersionInfo(const ServiceWorkerVersionInfo& version); | |
| 128 | 119 |
| 129 // ServiceWorkerContextObserver implements | 120 // ServiceWorkerContextObserver implements |
| 130 void OnRunningStateChanged(int64 version_id) override; | 121 virtual void OnNewLiveRegistration(int64 registration_id, |
| 131 void OnVersionStateChanged(int64 version_id) override; | 122 const GURL& pattern) override; |
| 132 void OnRegistrationStored(int64 registration_id, | 123 virtual void OnNewLiveVersion(int64 version_id, |
| 133 const GURL& pattern) override; | 124 int64 registration_id, |
| 125 const GURL& script_url) override; | |
| 126 void OnRunningStateChanged( | |
| 127 int64 version_id, | |
| 128 content::ServiceWorkerVersion::RunningStatus running_status) override; | |
| 129 void OnVersionStateChanged( | |
| 130 int64 version_id, | |
| 131 content::ServiceWorkerVersion::Status status) override; | |
| 134 void OnRegistrationDeleted(int64 registration_id, | 132 void OnRegistrationDeleted(int64 registration_id, |
| 135 const GURL& pattern) override; | 133 const GURL& pattern) override; |
| 136 | 134 |
| 135 base::ScopedPtrHashMap<int64, ServiceWorkerRegistrationInfo> | |
| 136 registration_info_map_; | |
| 137 base::ScopedPtrHashMap<int64, ServiceWorkerVersionInfo> version_info_map_; | |
|
Kunihiko Sakamoto
2015/03/12 08:08:46
It seems items entered in these maps are never rem
horo
2015/03/12 09:12:59
Changed to delete STOPPED & REDUNDANT versions.
| |
| 137 scoped_refptr<ServiceWorkerContextWrapper> context_; | 138 scoped_refptr<ServiceWorkerContextWrapper> context_; |
| 138 base::WeakPtr<ServiceWorkerHandler> handler_; | 139 base::WeakPtr<ServiceWorkerHandler> handler_; |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 ServiceWorkerHandler::ContextObserver::ContextObserver( | 142 ServiceWorkerHandler::ContextObserver::ContextObserver( |
| 142 scoped_refptr<ServiceWorkerContextWrapper> context, | 143 scoped_refptr<ServiceWorkerContextWrapper> context, |
| 143 base::WeakPtr<ServiceWorkerHandler> handler) | 144 base::WeakPtr<ServiceWorkerHandler> handler) |
| 144 : context_(context), handler_(handler) { | 145 : context_(context), handler_(handler) { |
| 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 146 } | 147 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 161 } | 162 } |
| 162 | 163 |
| 163 void ServiceWorkerHandler::ContextObserver::GetStoredRegistrationsOnIOThread() { | 164 void ServiceWorkerHandler::ContextObserver::GetStoredRegistrationsOnIOThread() { |
| 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 165 context_->context()->storage()->GetAllRegistrations(base::Bind( | 166 context_->context()->storage()->GetAllRegistrations(base::Bind( |
| 166 &ServiceWorkerHandler::ContextObserver::OnStoredRegistrationsOnIOThread, | 167 &ServiceWorkerHandler::ContextObserver::OnStoredRegistrationsOnIOThread, |
| 167 this)); | 168 this)); |
| 168 } | 169 } |
| 169 | 170 |
| 170 void ServiceWorkerHandler::ContextObserver::OnStoredRegistrationsOnIOThread( | 171 void ServiceWorkerHandler::ContextObserver::OnStoredRegistrationsOnIOThread( |
| 171 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 172 const std::vector<ServiceWorkerRegistrationInfo>& stored_registrations) { |
| 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 173 context_->AddObserver(this); | 174 context_->AddObserver(this); |
| 175 | |
| 176 for (const auto& registration : stored_registrations) | |
| 177 StoreRegistrationInfo(registration); | |
| 178 for (const auto& registration : | |
| 179 context_->context()->GetAllLiveRegistrationInfo()) | |
| 180 StoreRegistrationInfo(registration); | |
| 181 for (auto version : context_->context()->GetAllLiveVersionInfo()) | |
| 182 StoreVersionInfo(version); | |
| 183 | |
| 184 std::vector<ServiceWorkerRegistrationInfo> registrations; | |
| 185 registrations.reserve(registration_info_map_.size()); | |
| 186 for (const auto& registration_id_info_pair : registration_info_map_) | |
| 187 registrations.push_back(*registration_id_info_pair.second); | |
| 188 | |
| 189 std::vector<ServiceWorkerVersionInfo> versions; | |
| 190 versions.reserve(version_info_map_.size()); | |
| 191 for (const auto& version_id_info_pair : version_info_map_) | |
| 192 versions.push_back(*version_id_info_pair.second); | |
| 193 | |
| 174 BrowserThread::PostTask( | 194 BrowserThread::PostTask( |
| 175 BrowserThread::UI, FROM_HERE, | 195 BrowserThread::UI, FROM_HERE, |
| 176 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, | 196 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, |
| 177 registrations)); | 197 registrations)); |
| 178 BrowserThread::PostTask( | 198 BrowserThread::PostTask( |
| 179 BrowserThread::UI, FROM_HERE, | 199 BrowserThread::UI, FROM_HERE, |
| 180 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, | |
| 181 context_->context()->GetAllLiveRegistrationInfo())); | |
| 182 BrowserThread::PostTask( | |
| 183 BrowserThread::UI, FROM_HERE, | |
| 184 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, handler_, | 200 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, handler_, |
| 185 context_->context()->GetAllLiveVersionInfo())); | 201 versions)); |
| 186 } | 202 } |
| 187 | 203 |
| 188 void ServiceWorkerHandler::ContextObserver::StopOnIOThread() { | 204 void ServiceWorkerHandler::ContextObserver::StopOnIOThread() { |
| 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 190 context_->RemoveObserver(this); | 206 context_->RemoveObserver(this); |
| 191 } | 207 } |
| 192 | 208 |
| 193 ServiceWorkerHandler::ContextObserver::~ContextObserver() { | 209 ServiceWorkerHandler::ContextObserver::~ContextObserver() { |
| 194 } | 210 } |
| 195 | 211 |
| 196 void ServiceWorkerHandler::ContextObserver::OnVersionUpdated(int64 version_id) { | 212 void ServiceWorkerHandler::ContextObserver::StoreRegistrationInfo( |
| 213 const ServiceWorkerRegistrationInfo& registration_info) { | |
| 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 198 content::ServiceWorkerVersion* version = | 215 if (registration_info.registration_id == kInvalidServiceWorkerRegistrationId) |
| 199 context_->context()->GetLiveVersion(version_id); | |
| 200 if (!version) | |
| 201 return; | 216 return; |
| 202 OnRegistrationUpdated(version->registration_id()); | 217 registration_info_map_.set( |
| 218 registration_info.registration_id, | |
| 219 scoped_ptr<ServiceWorkerRegistrationInfo>( | |
| 220 new ServiceWorkerRegistrationInfo(registration_info))); | |
| 221 StoreVersionInfo(registration_info.active_version); | |
| 222 StoreVersionInfo(registration_info.waiting_version); | |
| 223 StoreVersionInfo(registration_info.installing_version); | |
| 224 } | |
| 225 | |
| 226 void ServiceWorkerHandler::ContextObserver::StoreVersionInfo( | |
| 227 const ServiceWorkerVersionInfo& version_info) { | |
| 228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 229 if (version_info.version_id == kInvalidServiceWorkerVersionId) | |
| 230 return; | |
| 231 version_info_map_.set(version_info.version_id, | |
| 232 scoped_ptr<ServiceWorkerVersionInfo>( | |
| 233 new ServiceWorkerVersionInfo(version_info))); | |
| 234 } | |
| 235 | |
| 236 void ServiceWorkerHandler::ContextObserver::SendRegistrationInfo( | |
| 237 const ServiceWorkerRegistrationInfo& registration) { | |
| 238 std::vector<ServiceWorkerRegistrationInfo> registrations; | |
| 239 registrations.push_back(registration); | |
| 240 BrowserThread::PostTask( | |
| 241 BrowserThread::UI, FROM_HERE, | |
| 242 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, | |
| 243 registrations)); | |
| 244 } | |
| 245 | |
| 246 void ServiceWorkerHandler::ContextObserver::SendVersionInfo( | |
| 247 const ServiceWorkerVersionInfo& version_info) { | |
| 248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 203 std::vector<ServiceWorkerVersionInfo> versions; | 249 std::vector<ServiceWorkerVersionInfo> versions; |
| 204 versions.push_back(version->GetInfo()); | 250 versions.push_back(version_info); |
| 205 BrowserThread::PostTask( | 251 BrowserThread::PostTask( |
| 206 BrowserThread::UI, FROM_HERE, | 252 BrowserThread::UI, FROM_HERE, |
| 207 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, handler_, | 253 base::Bind(&ServiceWorkerHandler::OnWorkerVersionUpdated, handler_, |
| 208 versions)); | 254 versions)); |
| 209 } | 255 } |
| 210 | 256 |
| 211 void ServiceWorkerHandler::ContextObserver::OnRegistrationUpdated( | 257 void ServiceWorkerHandler::ContextObserver::OnNewLiveRegistration( |
| 212 int64 registration_id) { | 258 int64 registration_id, |
| 213 content::ServiceWorkerRegistration* registration = | 259 const GURL& pattern) { |
| 214 context_->context()->GetLiveRegistration(registration_id); | 260 if (ServiceWorkerRegistrationInfo* registration_info = |
| 215 if (!registration) | 261 registration_info_map_.get(registration_id)) { |
| 262 DCHECK(registration_info->registration_id == registration_id); | |
| 263 DCHECK(registration_info->pattern == pattern); | |
| 216 return; | 264 return; |
| 217 std::vector<ServiceWorkerRegistrationInfo> registrations; | 265 } |
| 218 registrations.push_back(registration->GetInfo()); | 266 scoped_ptr<ServiceWorkerRegistrationInfo> registration_info( |
| 219 BrowserThread::PostTask( | 267 new ServiceWorkerRegistrationInfo()); |
| 220 BrowserThread::UI, FROM_HERE, | 268 registration_info->registration_id = registration_id; |
| 221 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, | 269 registration_info->pattern = pattern; |
| 222 registrations)); | 270 SendRegistrationInfo(*registration_info); |
| 271 registration_info_map_.set(registration_id, registration_info.Pass()); | |
| 272 } | |
| 273 | |
| 274 void ServiceWorkerHandler::ContextObserver::OnNewLiveVersion( | |
| 275 int64 version_id, | |
| 276 int64 registration_id, | |
| 277 const GURL& script_url) { | |
| 278 if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) { | |
| 279 DCHECK(version->registration_id == registration_id); | |
| 280 DCHECK(version->script_url == script_url); | |
| 281 return; | |
| 282 } | |
| 283 | |
| 284 scoped_ptr<ServiceWorkerVersionInfo> version(new ServiceWorkerVersionInfo()); | |
| 285 version->version_id = version_id; | |
| 286 version->registration_id = registration_id; | |
| 287 version->script_url = script_url; | |
| 288 SendVersionInfo(*version); | |
| 289 version_info_map_.set(version_id, version.Pass()); | |
| 223 } | 290 } |
| 224 | 291 |
| 225 void ServiceWorkerHandler::ContextObserver::OnRunningStateChanged( | 292 void ServiceWorkerHandler::ContextObserver::OnRunningStateChanged( |
| 226 int64 version_id) { | 293 int64 version_id, |
| 227 OnVersionUpdated(version_id); | 294 content::ServiceWorkerVersion::RunningStatus running_status) { |
| 295 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); | |
| 296 DCHECK(version); | |
| 297 if (version->running_status == running_status) | |
| 298 return; | |
| 299 version->running_status = running_status; | |
| 300 SendVersionInfo(*version); | |
| 228 } | 301 } |
| 229 | 302 |
| 230 void ServiceWorkerHandler::ContextObserver::OnVersionStateChanged( | 303 void ServiceWorkerHandler::ContextObserver::OnVersionStateChanged( |
| 231 int64 version_id) { | 304 int64 version_id, |
| 232 OnVersionUpdated(version_id); | 305 content::ServiceWorkerVersion::Status status) { |
| 233 } | 306 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
| 234 | 307 DCHECK(version); |
| 235 void ServiceWorkerHandler::ContextObserver::OnRegistrationStored( | 308 if (version->status == status) |
| 236 int64 registration_id, | 309 return; |
| 237 const GURL& pattern) { | 310 version->status = status; |
| 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 311 SendVersionInfo(*version); |
| 239 content::ServiceWorkerRegistration* registration = | |
| 240 context_->context()->GetLiveRegistration(registration_id); | |
| 241 DCHECK(registration); | |
| 242 std::vector<ServiceWorkerRegistrationInfo> registrations; | |
| 243 registrations.push_back(registration->GetInfo()); | |
| 244 BrowserThread::PostTask( | |
| 245 BrowserThread::UI, FROM_HERE, | |
| 246 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationUpdated, handler_, | |
| 247 registrations)); | |
| 248 } | 312 } |
| 249 | 313 |
| 250 void ServiceWorkerHandler::ContextObserver::OnRegistrationDeleted( | 314 void ServiceWorkerHandler::ContextObserver::OnRegistrationDeleted( |
| 251 int64 registration_id, | 315 int64 registration_id, |
| 252 const GURL& pattern) { | 316 const GURL& pattern) { |
| 253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 317 ServiceWorkerRegistrationInfo* registration = |
| 254 BrowserThread::PostTask( | 318 registration_info_map_.get(registration_id); |
| 255 BrowserThread::UI, FROM_HERE, | 319 DCHECK(registration); |
| 256 base::Bind(&ServiceWorkerHandler::OnWorkerRegistrationDeleted, handler_, | 320 registration->is_deleted = true; |
|
Kunihiko Sakamoto
2015/03/12 08:08:46
A deleted registration can be revived if register(
horo
2015/03/12 09:12:59
Done.
| |
| 257 registration_id)); | 321 SendRegistrationInfo(*registration); |
| 258 } | 322 } |
| 259 | 323 |
| 260 ServiceWorkerHandler::ServiceWorkerHandler() | 324 ServiceWorkerHandler::ServiceWorkerHandler() |
| 261 : enabled_(false), weak_factory_(this) { | 325 : enabled_(false), weak_factory_(this) { |
| 262 } | 326 } |
| 263 | 327 |
| 264 ServiceWorkerHandler::~ServiceWorkerHandler() { | 328 ServiceWorkerHandler::~ServiceWorkerHandler() { |
| 265 Disable(); | 329 Disable(); |
| 266 } | 330 } |
| 267 | 331 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 void ServiceWorkerHandler::OnWorkerVersionUpdated( | 443 void ServiceWorkerHandler::OnWorkerVersionUpdated( |
| 380 const std::vector<ServiceWorkerVersionInfo>& versions) { | 444 const std::vector<ServiceWorkerVersionInfo>& versions) { |
| 381 std::vector<scoped_refptr<ServiceWorkerVersion>> version_values; | 445 std::vector<scoped_refptr<ServiceWorkerVersion>> version_values; |
| 382 for (const auto& version : versions) { | 446 for (const auto& version : versions) { |
| 383 version_values.push_back(CreateVersionDictionaryValue(version)); | 447 version_values.push_back(CreateVersionDictionaryValue(version)); |
| 384 } | 448 } |
| 385 client_->WorkerVersionUpdated( | 449 client_->WorkerVersionUpdated( |
| 386 WorkerVersionUpdatedParams::Create()->set_versions(version_values)); | 450 WorkerVersionUpdatedParams::Create()->set_versions(version_values)); |
| 387 } | 451 } |
| 388 | 452 |
| 389 void ServiceWorkerHandler::OnWorkerRegistrationDeleted(int64 registration_id) { | |
| 390 client_->WorkerRegistrationDeleted( | |
| 391 WorkerRegistrationDeletedParams::Create()->set_registration_id( | |
| 392 base::Int64ToString(registration_id))); | |
| 393 } | |
| 394 | |
| 395 void ServiceWorkerHandler::DispatchProtocolMessage( | 453 void ServiceWorkerHandler::DispatchProtocolMessage( |
| 396 DevToolsAgentHost* host, | 454 DevToolsAgentHost* host, |
| 397 const std::string& message) { | 455 const std::string& message) { |
| 398 | 456 |
| 399 auto it = attached_hosts_.find(host->GetId()); | 457 auto it = attached_hosts_.find(host->GetId()); |
| 400 if (it == attached_hosts_.end()) | 458 if (it == attached_hosts_.end()) |
| 401 return; // Already disconnected. | 459 return; // Already disconnected. |
| 402 | 460 |
| 403 client_->DispatchMessage( | 461 client_->DispatchMessage( |
| 404 DispatchMessageParams::Create()-> | 462 DispatchMessageParams::Create()-> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 bool ServiceWorkerHandler::MatchesInspectedPage( | 503 bool ServiceWorkerHandler::MatchesInspectedPage( |
| 446 ServiceWorkerDevToolsAgentHost* host) { | 504 ServiceWorkerDevToolsAgentHost* host) { |
| 447 // TODO(pfeldman): match based on scope. | 505 // TODO(pfeldman): match based on scope. |
| 448 // TODO(pfeldman): match iframes. | 506 // TODO(pfeldman): match iframes. |
| 449 return host->GetURL().host() == url_.host(); | 507 return host->GetURL().host() == url_.host(); |
| 450 } | 508 } |
| 451 | 509 |
| 452 } // namespace service_worker | 510 } // namespace service_worker |
| 453 } // namespace devtools | 511 } // namespace devtools |
| 454 } // namespace content | 512 } // namespace content |
| OLD | NEW |