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

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

Issue 2958753003: Revert "Create ServiceWorkerProviderHost before starting worker" (Closed)
Patch Set: Created 3 years, 5 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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 29 matching lines...) Expand all
40 DCHECK(wrapper_); 40 DCHECK(wrapper_);
41 TRACE_EVENT0("ServiceWorker", 41 TRACE_EVENT0("ServiceWorker",
42 "EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed"); 42 "EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed");
43 43
44 wrapper_.reset(); 44 wrapper_.reset();
45 } 45 }
46 46
47 void EmbeddedWorkerInstanceClientImpl::StartWorker( 47 void EmbeddedWorkerInstanceClientImpl::StartWorker(
48 const EmbeddedWorkerStartParams& params, 48 const EmbeddedWorkerStartParams& params,
49 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, 49 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request,
50 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, 50 mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) {
51 mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info) {
52 DCHECK(ChildThreadImpl::current()); 51 DCHECK(ChildThreadImpl::current());
53 DCHECK(!wrapper_); 52 DCHECK(!wrapper_);
54 TRACE_EVENT0("ServiceWorker", 53 TRACE_EVENT0("ServiceWorker",
55 "EmbeddedWorkerInstanceClientImpl::StartWorker"); 54 "EmbeddedWorkerInstanceClientImpl::StartWorker");
56 55
57 wrapper_ = StartWorkerContext( 56 wrapper_ = StartWorkerContext(
58 params, base::MakeUnique<ServiceWorkerContextClient>( 57 params,
59 params.embedded_worker_id, params.service_worker_version_id, 58 base::MakeUnique<ServiceWorkerContextClient>(
60 params.scope, params.script_url, 59 params.embedded_worker_id, params.service_worker_version_id,
61 std::move(dispatcher_request), std::move(instance_host), 60 params.scope, params.script_url, std::move(dispatcher_request),
62 std::move(provider_info), std::move(temporal_self_))); 61 std::move(instance_host), std::move(temporal_self_)));
63 } 62 }
64 63
65 void EmbeddedWorkerInstanceClientImpl::StopWorker() { 64 void EmbeddedWorkerInstanceClientImpl::StopWorker() {
66 // StopWorker must be called after StartWorker is called. 65 // StopWorker must be called after StartWorker is called.
67 DCHECK(ChildThreadImpl::current()); 66 DCHECK(ChildThreadImpl::current());
68 DCHECK(wrapper_); 67 DCHECK(wrapper_);
69 68
70 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker"); 69 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker");
71 wrapper_->worker()->TerminateWorkerContext(); 70 wrapper_->worker()->TerminateWorkerContext();
72 } 71 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 start_data.pause_after_download_mode = 121 start_data.pause_after_download_mode =
123 params.pause_after_download 122 params.pause_after_download
124 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload 123 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload
125 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload; 124 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload;
126 125
127 wrapper->worker()->StartWorkerContext(start_data); 126 wrapper->worker()->StartWorkerContext(start_data);
128 return wrapper; 127 return wrapper;
129 } 128 }
130 129
131 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698