OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "content/browser/service_worker/embedded_worker_instance.h" | 10 #include "content/browser/service_worker/embedded_worker_instance.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 ServiceWorkerStatusCode status = embedded_worker_->SendMessage( | 299 ServiceWorkerStatusCode status = embedded_worker_->SendMessage( |
300 ServiceWorkerMsg_SyncEvent(request_id)); | 300 ServiceWorkerMsg_SyncEvent(request_id)); |
301 if (status != SERVICE_WORKER_OK) { | 301 if (status != SERVICE_WORKER_OK) { |
302 sync_callbacks_.Remove(request_id); | 302 sync_callbacks_.Remove(request_id); |
303 RunSoon(base::Bind(callback, status)); | 303 RunSoon(base::Bind(callback, status)); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 void ServiceWorkerVersion::DispatchPushEvent(const StatusCallback& callback, | 307 void ServiceWorkerVersion::DispatchPushEvent(const StatusCallback& callback, |
308 const std::string& data) { | 308 const std::string& data) { |
| 309 LOG(WARNING) << __FUNCTION__; |
309 DCHECK_EQ(ACTIVE, status()) << status(); | 310 DCHECK_EQ(ACTIVE, status()) << status(); |
310 | 311 |
311 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 312 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
312 switches::kEnableExperimentalWebPlatformFeatures)) { | 313 switches::kEnableExperimentalWebPlatformFeatures)) { |
313 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 314 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
314 return; | 315 return; |
315 } | 316 } |
316 | 317 |
317 if (running_status() != RUNNING) { | 318 if (running_status() != RUNNING) { |
318 // Schedule calling this method after starting the worker. | 319 // Schedule calling this method after starting the worker. |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 return; | 629 return; |
629 } | 630 } |
630 stop_worker_timer_.Start( | 631 stop_worker_timer_.Start( |
631 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay), | 632 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay), |
632 base::Bind(&ServiceWorkerVersion::StopWorker, | 633 base::Bind(&ServiceWorkerVersion::StopWorker, |
633 weak_factory_.GetWeakPtr(), | 634 weak_factory_.GetWeakPtr(), |
634 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback))); | 635 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback))); |
635 } | 636 } |
636 | 637 |
637 } // namespace content | 638 } // namespace content |
OLD | NEW |