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

Side by Side Diff: content/browser/shared_worker/shared_worker_service_impl.cc

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: same as PS6 Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shared_worker/shared_worker_service_impl.h" 5 #include "content/browser/shared_worker/shared_worker_service_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 blink::WebWorkerCreationError SharedWorkerServiceImpl::CreateWorker( 328 blink::WebWorkerCreationError SharedWorkerServiceImpl::CreateWorker(
329 const ViewHostMsg_CreateWorker_Params& params, 329 const ViewHostMsg_CreateWorker_Params& params,
330 int route_id, 330 int route_id,
331 SharedWorkerMessageFilter* filter, 331 SharedWorkerMessageFilter* filter,
332 ResourceContext* resource_context, 332 ResourceContext* resource_context,
333 const WorkerStoragePartitionId& partition_id) { 333 const WorkerStoragePartitionId& partition_id) {
334 DCHECK_CURRENTLY_ON(BrowserThread::IO); 334 DCHECK_CURRENTLY_ON(BrowserThread::IO);
335 std::unique_ptr<SharedWorkerInstance> instance(new SharedWorkerInstance( 335 std::unique_ptr<SharedWorkerInstance> instance(new SharedWorkerInstance(
336 params.url, params.name, params.content_security_policy, 336 params.url, params.name, params.content_security_policy,
337 params.security_policy_type, params.creation_address_space, 337 params.security_policy_type, params.creation_address_space,
338 resource_context, partition_id, params.creation_context_type)); 338 resource_context, partition_id, params.creation_context_type,
339 params.data_saver_enabled));
339 std::unique_ptr<SharedWorkerPendingInstance::SharedWorkerPendingRequest> 340 std::unique_ptr<SharedWorkerPendingInstance::SharedWorkerPendingRequest>
340 request(new SharedWorkerPendingInstance::SharedWorkerPendingRequest( 341 request(new SharedWorkerPendingInstance::SharedWorkerPendingRequest(
341 filter, route_id, params.document_id, filter->render_process_id(), 342 filter, route_id, params.document_id, filter->render_process_id(),
342 params.render_frame_route_id)); 343 params.render_frame_route_id));
343 if (SharedWorkerPendingInstance* pending = FindPendingInstance(*instance)) { 344 if (SharedWorkerPendingInstance* pending = FindPendingInstance(*instance)) {
344 pending->AddRequest(std::move(request)); 345 pending->AddRequest(std::move(request));
345 if (params.creation_context_type != 346 if (params.creation_context_type !=
346 pending->instance()->creation_context_type()) 347 pending->instance()->creation_context_type())
347 return blink::kWebWorkerCreationErrorSecureContextMismatch; 348 return blink::kWebWorkerCreationErrorSecureContextMismatch;
348 return blink::kWebWorkerCreationErrorNone; 349 return blink::kWebWorkerCreationErrorNone;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 UpdateWorkerDependencyFunc new_func) { 693 UpdateWorkerDependencyFunc new_func) {
693 update_worker_dependency_ = new_func; 694 update_worker_dependency_ = new_func;
694 } 695 }
695 696
696 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( 697 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting(
697 bool (*new_func)(int)) { 698 bool (*new_func)(int)) {
698 s_try_increment_worker_ref_count_ = new_func; 699 s_try_increment_worker_ref_count_ = new_func;
699 } 700 }
700 701
701 } // namespace content 702 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_instance_unittest.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698