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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 340773006: Dispatch push event to worker from PushServiceImpl#OnMessage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Debugging. Created 6 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 | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698