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

Side by Side Diff: content/renderer/service_worker/embedded_worker_instance_client_impl.cc

Issue 2779763004: Create ServiceWorkerProviderHost before starting worker (Closed)
Patch Set: Pass the param of BindWithProviderInfo by value instead of pointer Created 3 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/renderer/service_worker/embedded_worker_instance_client_impl.h " 5 #include "content/renderer/service_worker/embedded_worker_instance_client_impl.h "
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 "ServiceWorker.TerminateThread.Time", 47 "ServiceWorker.TerminateThread.Time",
48 base::TimeTicks::Now() - stop_worker_time_.value()); 48 base::TimeTicks::Now() - stop_worker_time_.value());
49 stop_worker_time_.reset(); 49 stop_worker_time_.reset();
50 } 50 }
51 wrapper_.reset(); 51 wrapper_.reset();
52 } 52 }
53 53
54 void EmbeddedWorkerInstanceClientImpl::StartWorker( 54 void EmbeddedWorkerInstanceClientImpl::StartWorker(
55 const EmbeddedWorkerStartParams& params, 55 const EmbeddedWorkerStartParams& params,
56 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, 56 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request,
57 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { 57 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host,
58 mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info) {
58 DCHECK(ChildThreadImpl::current()); 59 DCHECK(ChildThreadImpl::current());
59 DCHECK(!wrapper_); 60 DCHECK(!wrapper_);
60 DCHECK(!stop_worker_time_.has_value()); 61 DCHECK(!stop_worker_time_.has_value());
61 TRACE_EVENT0("ServiceWorker", 62 TRACE_EVENT0("ServiceWorker",
62 "EmbeddedWorkerInstanceClientImpl::StartWorker"); 63 "EmbeddedWorkerInstanceClientImpl::StartWorker");
63 64
64 wrapper_ = StartWorkerContext( 65 wrapper_ = StartWorkerContext(
65 params, 66 params, base::MakeUnique<ServiceWorkerContextClient>(
66 base::MakeUnique<ServiceWorkerContextClient>( 67 params.embedded_worker_id, params.service_worker_version_id,
67 params.embedded_worker_id, params.service_worker_version_id, 68 params.scope, params.script_url,
68 params.scope, params.script_url, std::move(dispatcher_request), 69 std::move(dispatcher_request), std::move(instance_host),
69 std::move(instance_host), std::move(temporal_self_))); 70 std::move(provider_info), std::move(temporal_self_)));
70 } 71 }
71 72
72 void EmbeddedWorkerInstanceClientImpl::StopWorker() { 73 void EmbeddedWorkerInstanceClientImpl::StopWorker() {
73 // StopWorker must be called after StartWorker is called. 74 // StopWorker must be called after StartWorker is called.
74 DCHECK(ChildThreadImpl::current()); 75 DCHECK(ChildThreadImpl::current());
75 DCHECK(wrapper_); 76 DCHECK(wrapper_);
76 DCHECK(!stop_worker_time_.has_value()); 77 DCHECK(!stop_worker_time_.has_value());
77 78
78 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker"); 79 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker");
79 stop_worker_time_ = base::TimeTicks::Now(); 80 stop_worker_time_ = base::TimeTicks::Now();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 start_data.pause_after_download_mode = 132 start_data.pause_after_download_mode =
132 params.pause_after_download 133 params.pause_after_download
133 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload 134 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload
134 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload; 135 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload;
135 136
136 wrapper->worker()->StartWorkerContext(start_data); 137 wrapper->worker()->StartWorkerContext(start_data);
137 return wrapper; 138 return wrapper;
138 } 139 }
139 140
140 } // namespace content 141 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698