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

Side by Side Diff: content/browser/storage_partition_impl.cc

Issue 2906543002: Add support for reading blobs when using the network service. (Closed)
Patch Set: fix threading issue with weakptr 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
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/url_loader_factory_getter.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
18 #include "content/browser/browser_main_loop.h" 19 #include "content/browser/browser_main_loop.h"
19 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h" 20 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h"
20 #include "content/browser/fileapi/browser_file_system_helper.h" 21 #include "content/browser/fileapi/browser_file_system_helper.h"
21 #include "content/browser/gpu/shader_cache_factory.h" 22 #include "content/browser/gpu/shader_cache_factory.h"
22 #include "content/browser/notifications/platform_notification_context_impl.h" 23 #include "content/browser/notifications/platform_notification_context_impl.h"
23 #include "content/common/dom_storage/dom_storage_types.h" 24 #include "content/common/dom_storage/dom_storage_types.h"
24 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/content_browser_client.h" 27 #include "content/public/browser/content_browser_client.h"
27 #include "content/public/browser/dom_storage_context.h" 28 #include "content/public/browser/dom_storage_context.h"
28 #include "content/public/browser/indexed_db_context.h" 29 #include "content/public/browser/indexed_db_context.h"
29 #include "content/public/browser/local_storage_usage_info.h" 30 #include "content/public/browser/local_storage_usage_info.h"
30 #include "content/public/browser/session_storage_usage_info.h" 31 #include "content/public/browser/session_storage_usage_info.h"
31 #include "content/public/common/content_client.h" 32 #include "content/public/common/content_client.h"
32 #include "content/public/common/content_switches.h" 33 #include "content/public/common/content_switches.h"
33 #include "content/public/common/service_manager_connection.h" 34 #include "content/public/common/service_manager_connection.h"
34 #include "content/public/common/service_names.mojom.h" 35 #include "content/public/common/service_names.mojom.h"
35 #include "net/base/completion_callback.h" 36 #include "net/base/completion_callback.h"
36 #include "net/base/net_errors.h" 37 #include "net/base/net_errors.h"
37 #include "net/cookies/canonical_cookie.h" 38 #include "net/cookies/canonical_cookie.h"
38 #include "net/cookies/cookie_monster.h" 39 #include "net/cookies/cookie_monster.h"
39 #include "net/url_request/url_request_context.h" 40 #include "net/url_request/url_request_context.h"
40 #include "net/url_request/url_request_context_getter.h" 41 #include "net/url_request/url_request_context_getter.h"
41 #include "ppapi/features/features.h" 42 #include "ppapi/features/features.h"
42 #include "services/service_manager/public/cpp/connector.h" 43 #include "services/service_manager/public/cpp/connector.h"
44 #include "storage/browser/blob/blob_storage_context.h"
43 #include "storage/browser/database/database_tracker.h" 45 #include "storage/browser/database/database_tracker.h"
44 #include "storage/browser/quota/quota_manager.h" 46 #include "storage/browser/quota/quota_manager.h"
45 47
46 #if !defined(OS_ANDROID) 48 #if !defined(OS_ANDROID)
47 #include "content/browser/host_zoom_map_impl.h" 49 #include "content/browser/host_zoom_map_impl.h"
48 #endif // !defined(OS_ANDROID) 50 #endif // !defined(OS_ANDROID)
49 51
50 #if BUILDFLAG(ENABLE_PLUGINS) 52 #if BUILDFLAG(ENABLE_PLUGINS)
51 #include "content/browser/plugin_private_storage_helper.h" 53 #include "content/browser/plugin_private_storage_helper.h"
52 #endif // BUILDFLAG(ENABLE_PLUGINS) 54 #endif // BUILDFLAG(ENABLE_PLUGINS)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const StoragePartition::OriginMatcherFunction& origin_matcher, 225 const StoragePartition::OriginMatcherFunction& origin_matcher,
224 const base::Closure& callback) { 226 const base::Closure& callback) {
225 DCHECK_CURRENTLY_ON(BrowserThread::UI); 227 DCHECK_CURRENTLY_ON(BrowserThread::UI);
226 228
227 dom_storage_context->GetSessionStorageUsage( 229 dom_storage_context->GetSessionStorageUsage(
228 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, 230 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context,
229 special_storage_policy, origin_matcher, 231 special_storage_policy, origin_matcher,
230 callback)); 232 callback));
231 } 233 }
232 234
235 base::WeakPtr<storage::BlobStorageContext> BlobStorageContextGetter(
236 scoped_refptr<ChromeBlobStorageContext> blob_context) {
237 DCHECK_CURRENTLY_ON(BrowserThread::IO);
238 return blob_context->context()->AsWeakPtr();
239 }
240
233 } // namespace 241 } // namespace
234 242
235 // Static. 243 // Static.
236 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) { 244 int StoragePartitionImpl::GenerateQuotaClientMask(uint32_t remove_mask) {
237 int quota_client_mask = 0; 245 int quota_client_mask = 0;
238 246
239 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) 247 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS)
240 quota_client_mask |= storage::QuotaClient::kFileSystem; 248 quota_client_mask |= storage::QuotaClient::kFileSystem;
241 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) 249 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL)
242 quota_client_mask |= storage::QuotaClient::kDatabase; 250 quota_client_mask |= storage::QuotaClient::kDatabase;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( 530 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
523 mojom::kNetworkServiceName, &network_service); 531 mojom::kNetworkServiceName, &network_service);
524 mojom::NetworkContextParamsPtr context_params = 532 mojom::NetworkContextParamsPtr context_params =
525 mojom::NetworkContextParams::New(); 533 mojom::NetworkContextParams::New();
526 // TODO: fill this 534 // TODO: fill this
527 // context_params->cache_dir = 535 // context_params->cache_dir =
528 // context_params->cookie_path = 536 // context_params->cookie_path =
529 network_service->CreateNetworkContext( 537 network_service->CreateNetworkContext(
530 MakeRequest(&partition->network_context_), std::move(context_params)); 538 MakeRequest(&partition->network_context_), std::move(context_params));
531 539
540 scoped_refptr<ChromeBlobStorageContext> blob_context =
541 ChromeBlobStorageContext::GetFor(context);
542 BlobURLLoaderFactory::BlobContextGetter blob_getter =
543 base::BindOnce(&BlobStorageContextGetter, blob_context);
544 partition->blob_url_loader_factory_ = new BlobURLLoaderFactory(
545 std::move(blob_getter), partition->filesystem_context_);
546
532 partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter(); 547 partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter();
533 partition->url_loader_factory_getter_->Initialize(partition.get()); 548 partition->url_loader_factory_getter_->Initialize(partition.get());
534 } 549 }
535 550
536 return partition; 551 return partition;
537 } 552 }
538 553
539 base::FilePath StoragePartitionImpl::GetPath() { 554 base::FilePath StoragePartitionImpl::GetPath() {
540 return partition_path_; 555 return partition_path_;
541 } 556 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 631
617 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() { 632 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() {
618 return broadcast_channel_provider_.get(); 633 return broadcast_channel_provider_.get();
619 } 634 }
620 635
621 BluetoothAllowedDevicesMap* 636 BluetoothAllowedDevicesMap*
622 StoragePartitionImpl::GetBluetoothAllowedDevicesMap() { 637 StoragePartitionImpl::GetBluetoothAllowedDevicesMap() {
623 return bluetooth_allowed_devices_map_.get(); 638 return bluetooth_allowed_devices_map_.get();
624 } 639 }
625 640
641 BlobURLLoaderFactory* StoragePartitionImpl::GetBlobURLLoaderFactory() {
642 return blob_url_loader_factory_.get();
643 }
644
626 void StoragePartitionImpl::OpenLocalStorage( 645 void StoragePartitionImpl::OpenLocalStorage(
627 const url::Origin& origin, 646 const url::Origin& origin,
628 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) { 647 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) {
629 dom_storage_context_->OpenLocalStorage(origin, std::move(request)); 648 dom_storage_context_->OpenLocalStorage(origin, std::move(request));
630 } 649 }
631 650
632 void StoragePartitionImpl::ClearDataImpl( 651 void StoragePartitionImpl::ClearDataImpl(
633 uint32_t remove_mask, 652 uint32_t remove_mask,
634 uint32_t quota_storage_remove_mask, 653 uint32_t quota_storage_remove_mask,
635 const GURL& storage_origin, 654 const GURL& storage_origin,
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 media_url_request_context_ = media_url_request_context; 981 media_url_request_context_ = media_url_request_context;
963 } 982 }
964 983
965 void StoragePartitionImpl::GetQuotaSettings( 984 void StoragePartitionImpl::GetQuotaSettings(
966 const storage::OptionalQuotaSettingsCallback& callback) { 985 const storage::OptionalQuotaSettingsCallback& callback) {
967 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, 986 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this,
968 callback); 987 callback);
969 } 988 }
970 989
971 } // namespace content 990 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/url_loader_factory_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698