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

Side by Side Diff: content/browser/worker_host/worker_storage_partition.h

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 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 | Annotate | Revision Log
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 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 class ChromeAppCacheService; 10 class ChromeAppCacheService;
11 class IndexedDBContextImpl; 11 class IndexedDBContextImpl;
12 12
13 namespace fileapi { 13 namespace fileapi {
14 class FileSystemContext; 14 class FileSystemContext;
15 } // namespace fileapi 15 } // namespace fileapi
16 16
17 namespace net {
18 class URLRequestContextGetter;
19 }
20
17 namespace webkit_database { 21 namespace webkit_database {
18 class DatabaseTracker; 22 class DatabaseTracker;
19 } // namespace webkit_database 23 } // namespace webkit_database
20 24
21 // Contains the data from StoragePartition for use by Worker APIs. 25 // Contains the data from StoragePartition for use by Worker APIs.
22 // 26 //
23 // StoragePartition meant for the UI so we can't use it directly in many 27 // StoragePartition meant for the UI so we can't use it directly in many
24 // Worker APIs that run on the IO thread. While we could make it RefCounted, 28 // Worker APIs that run on the IO thread. While we could make it RefCounted,
25 // the Worker system is the only place that really needs access on the IO 29 // the Worker system is the only place that really needs access on the IO
26 // thread. Instead of changing the lifetime semantics of StoragePartition, 30 // thread. Instead of changing the lifetime semantics of StoragePartition,
27 // we just create a parallel struct here to simplify the APIs of various 31 // we just create a parallel struct here to simplify the APIs of various
28 // methods in WorkerServiceImpl. 32 // methods in WorkerServiceImpl.
29 // 33 //
30 // This class is effectively a struct, but we make it a class because we want to 34 // This class is effectively a struct, but we make it a class because we want to
31 // define copy constructors, assignment operators, and an Equals() function for 35 // define copy constructors, assignment operators, and an Equals() function for
32 // it which makes it look awkward as a struct. 36 // it which makes it look awkward as a struct.
33 class WorkerStoragePartition { 37 class WorkerStoragePartition {
34 public: 38 public:
35 WorkerStoragePartition(ChromeAppCacheService* appcache_service, 39 WorkerStoragePartition(
36 fileapi::FileSystemContext* filesystem_context, 40 net::URLRequestContextGetter* url_request_context,
37 webkit_database::DatabaseTracker* database_tracker, 41 net::URLRequestContextGetter* media_url_request_context,
38 IndexedDBContextImpl* indexed_db_context); 42 ChromeAppCacheService* appcache_service,
43 fileapi::FileSystemContext* filesystem_context,
44 webkit_database::DatabaseTracker* database_tracker,
45 IndexedDBContextImpl* indexed_db_context);
39 ~WorkerStoragePartition(); 46 ~WorkerStoragePartition();
40 47
41 // Declaring so these don't get inlined which has the unfortunate effect of 48 // Declaring so these don't get inlined which has the unfortunate effect of
42 // requiring all including classes to have the full definition of every member 49 // requiring all including classes to have the full definition of every member
43 // type. 50 // type.
44 WorkerStoragePartition(const WorkerStoragePartition& other); 51 WorkerStoragePartition(const WorkerStoragePartition& other);
45 const WorkerStoragePartition& operator=(const WorkerStoragePartition& rhs); 52 const WorkerStoragePartition& operator=(const WorkerStoragePartition& rhs);
46 53
47 bool Equals(const WorkerStoragePartition& other) const; 54 bool Equals(const WorkerStoragePartition& other) const;
48 55
56 net::URLRequestContextGetter* url_request_context() const {
57 return url_request_context_.get();
58 }
59
60 net::URLRequestContextGetter* media_url_request_context() const {
61 return media_url_request_context_.get();
62 }
63
49 ChromeAppCacheService* appcache_service() const { 64 ChromeAppCacheService* appcache_service() const {
50 return appcache_service_.get(); 65 return appcache_service_.get();
51 } 66 }
52 67
53 fileapi::FileSystemContext* filesystem_context() const { 68 fileapi::FileSystemContext* filesystem_context() const {
54 return filesystem_context_.get(); 69 return filesystem_context_.get();
55 } 70 }
56 71
57 webkit_database::DatabaseTracker* database_tracker() const { 72 webkit_database::DatabaseTracker* database_tracker() const {
58 return database_tracker_.get(); 73 return database_tracker_.get();
59 } 74 }
60 75
61 IndexedDBContextImpl* indexed_db_context() const { 76 IndexedDBContextImpl* indexed_db_context() const {
62 return indexed_db_context_.get(); 77 return indexed_db_context_.get();
63 } 78 }
64 79
65 private: 80 private:
66 void Copy(const WorkerStoragePartition& other); 81 void Copy(const WorkerStoragePartition& other);
67 82
83 scoped_refptr<net::URLRequestContextGetter> url_request_context_;
84 scoped_refptr<net::URLRequestContextGetter> media_url_request_context_;
68 scoped_refptr<ChromeAppCacheService> appcache_service_; 85 scoped_refptr<ChromeAppCacheService> appcache_service_;
69 scoped_refptr<fileapi::FileSystemContext> filesystem_context_; 86 scoped_refptr<fileapi::FileSystemContext> filesystem_context_;
70 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; 87 scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
71 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 88 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
72 }; 89 };
73 90
74 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_ 91 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_STORAGE_PARTITION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698