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

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

Issue 966393002: ServiceWorkerVersion: remove unused parameter in DispatchInstallEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 5 years, 9 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 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/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 embedded_worker_->message_port_message_filter(); 456 embedded_worker_->message_port_message_filter();
457 std::vector<int> new_routing_ids; 457 std::vector<int> new_routing_ids;
458 filter->UpdateMessagePortsWithNewRoutes(sent_message_ports, &new_routing_ids); 458 filter->UpdateMessagePortsWithNewRoutes(sent_message_ports, &new_routing_ids);
459 ServiceWorkerStatusCode status = 459 ServiceWorkerStatusCode status =
460 embedded_worker_->SendMessage(ServiceWorkerMsg_MessageToWorker( 460 embedded_worker_->SendMessage(ServiceWorkerMsg_MessageToWorker(
461 message, sent_message_ports, new_routing_ids)); 461 message, sent_message_ports, new_routing_ids));
462 RunSoon(base::Bind(callback, status)); 462 RunSoon(base::Bind(callback, status));
463 } 463 }
464 464
465 void ServiceWorkerVersion::DispatchInstallEvent( 465 void ServiceWorkerVersion::DispatchInstallEvent(
466 int active_version_id,
467 const StatusCallback& callback) { 466 const StatusCallback& callback) {
468 DCHECK_EQ(INSTALLING, status()) << status(); 467 DCHECK_EQ(INSTALLING, status()) << status();
469 468
470 if (running_status() != RUNNING) { 469 if (running_status() != RUNNING) {
471 // Schedule calling this method after starting the worker. 470 // Schedule calling this method after starting the worker.
472 StartWorker( 471 StartWorker(
473 base::Bind(&RunTaskAfterStartWorker, 472 base::Bind(&RunTaskAfterStartWorker,
474 weak_factory_.GetWeakPtr(), 473 weak_factory_.GetWeakPtr(),
475 callback, 474 callback,
476 base::Bind(&self::DispatchInstallEventAfterStartWorker, 475 base::Bind(&self::DispatchInstallEventAfterStartWorker,
477 weak_factory_.GetWeakPtr(), 476 weak_factory_.GetWeakPtr(),
478 active_version_id,
479 callback))); 477 callback)));
480 } else { 478 } else {
481 DispatchInstallEventAfterStartWorker(active_version_id, callback); 479 DispatchInstallEventAfterStartWorker(callback);
482 } 480 }
483 } 481 }
484 482
485 void ServiceWorkerVersion::DispatchActivateEvent( 483 void ServiceWorkerVersion::DispatchActivateEvent(
486 const StatusCallback& callback) { 484 const StatusCallback& callback) {
487 DCHECK_EQ(ACTIVATING, status()) << status(); 485 DCHECK_EQ(ACTIVATING, status()) << status();
488 486
489 if (running_status() != RUNNING) { 487 if (running_status() != RUNNING) {
490 // Schedule calling this method after starting the worker. 488 // Schedule calling this method after starting the worker.
491 StartWorker( 489 StartWorker(
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 return handled; 935 return handled;
938 } 936 }
939 937
940 void ServiceWorkerVersion::OnStartMessageSent( 938 void ServiceWorkerVersion::OnStartMessageSent(
941 ServiceWorkerStatusCode status) { 939 ServiceWorkerStatusCode status) {
942 if (status != SERVICE_WORKER_OK) 940 if (status != SERVICE_WORKER_OK)
943 RunCallbacks(this, &start_callbacks_, status); 941 RunCallbacks(this, &start_callbacks_, status);
944 } 942 }
945 943
946 void ServiceWorkerVersion::DispatchInstallEventAfterStartWorker( 944 void ServiceWorkerVersion::DispatchInstallEventAfterStartWorker(
947 int active_version_id,
948 const StatusCallback& callback) { 945 const StatusCallback& callback) {
949 DCHECK_EQ(RUNNING, running_status()) 946 DCHECK_EQ(RUNNING, running_status())
950 << "Worker stopped too soon after it was started."; 947 << "Worker stopped too soon after it was started.";
951 948
952 int request_id = install_callbacks_.Add(new StatusCallback(callback)); 949 int request_id = install_callbacks_.Add(new StatusCallback(callback));
953 ServiceWorkerStatusCode status = embedded_worker_->SendMessage( 950 ServiceWorkerStatusCode status = embedded_worker_->SendMessage(
954 ServiceWorkerMsg_InstallEvent(request_id, active_version_id)); 951 ServiceWorkerMsg_InstallEvent(request_id));
955 if (status != SERVICE_WORKER_OK) { 952 if (status != SERVICE_WORKER_OK) {
956 install_callbacks_.Remove(request_id); 953 install_callbacks_.Remove(request_id);
957 RunSoon(base::Bind(callback, status)); 954 RunSoon(base::Bind(callback, status));
958 } 955 }
959 } 956 }
960 957
961 void ServiceWorkerVersion::DispatchActivateEventAfterStartWorker( 958 void ServiceWorkerVersion::DispatchActivateEventAfterStartWorker(
962 const StatusCallback& callback) { 959 const StatusCallback& callback) {
963 DCHECK_EQ(RUNNING, running_status()) 960 DCHECK_EQ(RUNNING, running_status())
964 << "Worker stopped too soon after it was started."; 961 << "Worker stopped too soon after it was started.";
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 int request_id) { 1498 int request_id) {
1502 callbacks->Remove(request_id); 1499 callbacks->Remove(request_id);
1503 if (is_doomed_) { 1500 if (is_doomed_) {
1504 // The stop should be already scheduled, but try to stop immediately, in 1501 // The stop should be already scheduled, but try to stop immediately, in
1505 // order to release worker resources soon. 1502 // order to release worker resources soon.
1506 StopWorkerIfIdle(); 1503 StopWorkerIfIdle();
1507 } 1504 }
1508 } 1505 }
1509 1506
1510 } // namespace content 1507 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698