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

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

Issue 2374353002: Revert "Revert of ServiceWorker: Implement StartWorker by using mojo (patchset #1 id:1 of https://c… (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/browser/service_worker/service_worker_job_unittest.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 17 matching lines...) Expand all
28 #include "content/browser/message_port_service.h" 28 #include "content/browser/message_port_service.h"
29 #include "content/browser/service_worker/embedded_worker_instance.h" 29 #include "content/browser/service_worker/embedded_worker_instance.h"
30 #include "content/browser/service_worker/embedded_worker_registry.h" 30 #include "content/browser/service_worker/embedded_worker_registry.h"
31 #include "content/browser/service_worker/embedded_worker_status.h" 31 #include "content/browser/service_worker/embedded_worker_status.h"
32 #include "content/browser/service_worker/service_worker_client_utils.h" 32 #include "content/browser/service_worker/service_worker_client_utils.h"
33 #include "content/browser/service_worker/service_worker_context_core.h" 33 #include "content/browser/service_worker/service_worker_context_core.h"
34 #include "content/browser/service_worker/service_worker_context_wrapper.h" 34 #include "content/browser/service_worker/service_worker_context_wrapper.h"
35 #include "content/browser/service_worker/service_worker_metrics.h" 35 #include "content/browser/service_worker/service_worker_metrics.h"
36 #include "content/browser/service_worker/service_worker_registration.h" 36 #include "content/browser/service_worker/service_worker_registration.h"
37 #include "content/common/service_worker/embedded_worker_messages.h" 37 #include "content/common/service_worker/embedded_worker_messages.h"
38 #include "content/common/service_worker/embedded_worker_start_params.h"
38 #include "content/common/service_worker/service_worker_messages.h" 39 #include "content/common/service_worker/service_worker_messages.h"
39 #include "content/common/service_worker/service_worker_type_converters.h" 40 #include "content/common/service_worker/service_worker_type_converters.h"
40 #include "content/common/service_worker/service_worker_utils.h" 41 #include "content/common/service_worker/service_worker_utils.h"
41 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
42 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
43 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
44 #include "content/public/common/content_client.h" 45 #include "content/public/common/content_client.h"
45 #include "content/public/common/content_switches.h" 46 #include "content/public/common/content_switches.h"
46 #include "content/public/common/result_codes.h" 47 #include "content/public/common/result_codes.h"
47 #include "mojo/common/common_type_converters.h" 48 #include "mojo/common/common_type_converters.h"
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 DCHECK(!metrics_); 1400 DCHECK(!metrics_);
1400 DCHECK(start_worker_first_purpose_); 1401 DCHECK(start_worker_first_purpose_);
1401 metrics_.reset(new Metrics(this, start_worker_first_purpose_.value())); 1402 metrics_.reset(new Metrics(this, start_worker_first_purpose_.value()));
1402 1403
1403 // We don't clear |start_worker_first_purpose_| here but clear in 1404 // We don't clear |start_worker_first_purpose_| here but clear in
1404 // FinishStartWorker. This is because StartWorkerInternal may be called 1405 // FinishStartWorker. This is because StartWorkerInternal may be called
1405 // again from OnStoppedInternal if StopWorker is called before OnStarted. 1406 // again from OnStoppedInternal if StopWorker is called before OnStarted.
1406 1407
1407 StartTimeoutTimer(); 1408 StartTimeoutTimer();
1408 1409
1409 std::unique_ptr<EmbeddedWorkerMsg_StartWorker_Params> params( 1410 std::unique_ptr<EmbeddedWorkerStartParams> params(
1410 new EmbeddedWorkerMsg_StartWorker_Params()); 1411 new EmbeddedWorkerStartParams());
1411 params->service_worker_version_id = version_id_; 1412 params->service_worker_version_id = version_id_;
1412 params->scope = scope_; 1413 params->scope = scope_;
1413 params->script_url = script_url_; 1414 params->script_url = script_url_;
1414 params->is_installed = IsInstalled(status_); 1415 params->is_installed = IsInstalled(status_);
1415 params->pause_after_download = pause_after_download_; 1416 params->pause_after_download = pause_after_download_;
1416 1417
1417 embedded_worker_->Start( 1418 embedded_worker_->Start(
1418 std::move(params), 1419 std::move(params),
1419 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, 1420 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated,
1420 weak_factory_.GetWeakPtr())); 1421 weak_factory_.GetWeakPtr()));
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - 1795 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() -
1795 idle_time_); 1796 idle_time_);
1796 } 1797 }
1797 1798
1798 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) { 1799 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) {
1799 start_worker_first_purpose_ = base::nullopt; 1800 start_worker_first_purpose_ = base::nullopt;
1800 RunCallbacks(this, &start_callbacks_, status); 1801 RunCallbacks(this, &start_callbacks_, status);
1801 } 1802 }
1802 1803
1803 } // namespace content 1804 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_job_unittest.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698