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

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

Issue 2936623002: Implement dumb URLLoader{Factory} for ServiceWorker script loading (for try)
Patch Set: . 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/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::ServiceWorkerProviderClientInfoPtr provider_client_info) {
51 DCHECK(ChildThreadImpl::current()); 52 DCHECK(ChildThreadImpl::current());
52 DCHECK(!wrapper_); 53 DCHECK(!wrapper_);
53 TRACE_EVENT0("ServiceWorker", 54 TRACE_EVENT0("ServiceWorker",
54 "EmbeddedWorkerInstanceClientImpl::StartWorker"); 55 "EmbeddedWorkerInstanceClientImpl::StartWorker");
55 56
56 wrapper_ = StartWorkerContext( 57 wrapper_ = StartWorkerContext(
57 params, 58 params, base::MakeUnique<ServiceWorkerContextClient>(
58 base::MakeUnique<ServiceWorkerContextClient>( 59 params.embedded_worker_id, params.service_worker_version_id,
59 params.embedded_worker_id, params.service_worker_version_id, 60 params.scope, params.script_url,
60 params.scope, params.script_url, std::move(dispatcher_request), 61 std::move(dispatcher_request), std::move(instance_host),
61 std::move(instance_host), std::move(temporal_self_))); 62 std::move(provider_client_info), std::move(temporal_self_)));
62 } 63 }
63 64
64 void EmbeddedWorkerInstanceClientImpl::StopWorker() { 65 void EmbeddedWorkerInstanceClientImpl::StopWorker() {
65 // StopWorker must be called after StartWorker is called. 66 // StopWorker must be called after StartWorker is called.
66 DCHECK(ChildThreadImpl::current()); 67 DCHECK(ChildThreadImpl::current());
67 DCHECK(wrapper_); 68 DCHECK(wrapper_);
68 69
69 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker"); 70 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker");
70 wrapper_->worker()->TerminateWorkerContext(); 71 wrapper_->worker()->TerminateWorkerContext();
71 } 72 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 start_data.pause_after_download_mode = 122 start_data.pause_after_download_mode =
122 params.pause_after_download 123 params.pause_after_download
123 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload 124 ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload
124 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload; 125 : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload;
125 126
126 wrapper->worker()->StartWorkerContext(start_data); 127 wrapper->worker()->StartWorkerContext(start_data);
127 return wrapper; 128 return wrapper;
128 } 129 }
129 130
130 } // namespace content 131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698