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

Side by Side Diff: content/browser/blob_storage/blob_dispatcher_host.h

Issue 2245273002: [BlobStorage] Added back security policy for files in blobs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 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 | « no previous file | content/browser/blob_storage/blob_dispatcher_host.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 namespace IPC { 25 namespace IPC {
26 class Sender; 26 class Sender;
27 } 27 }
28 28
29 namespace storage { 29 namespace storage {
30 class DataElement; 30 class DataElement;
31 class BlobDataBuilder; 31 class BlobDataBuilder;
32 struct BlobItemBytesRequest; 32 struct BlobItemBytesRequest;
33 struct BlobItemBytesResponse; 33 struct BlobItemBytesResponse;
34 class BlobStorageContext; 34 class BlobStorageContext;
35 class FileSystemContext;
35 } 36 }
36 37
37 namespace content { 38 namespace content {
38 class ChromeBlobStorageContext; 39 class ChromeBlobStorageContext;
39 40
40 // This class's responsibility is to listen for and dispatch blob storage 41 // This class's responsibility is to listen for and dispatch blob storage
41 // messages and handle logistics of blob storage for a single child process. 42 // messages and handle logistics of blob storage for a single child process.
42 // When the child process terminates all blob references attributable to 43 // When the child process terminates all blob references attributable to
43 // that process go away upon destruction of the instance. 44 // that process go away upon destruction of the instance.
44 // This lives in the browser process, is single threaded (IO thread), and there 45 // This lives in the browser process, is single threaded (IO thread), and there
45 // is one per child process. 46 // is one per child process.
46 class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter { 47 class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter {
47 public: 48 public:
48 explicit BlobDispatcherHost(ChromeBlobStorageContext* blob_storage_context); 49 BlobDispatcherHost(
50 int process_id,
51 scoped_refptr<ChromeBlobStorageContext> blob_storage_context,
52 scoped_refptr<storage::FileSystemContext> file_system_context);
49 53
50 // BrowserMessageFilter implementation. 54 // BrowserMessageFilter implementation.
51 void OnChannelClosing() override; 55 void OnChannelClosing() override;
52 bool OnMessageReceived(const IPC::Message& message) override; 56 bool OnMessageReceived(const IPC::Message& message) override;
53 57
54 protected: 58 protected:
55 ~BlobDispatcherHost() override; 59 ~BlobDispatcherHost() override;
56 60
57 // For testing use only. 61 // For testing use only.
58 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size, 62 void SetMemoryConstantsForTesting(size_t max_ipc_memory_size,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Send the appropriate IPC response to the renderer for the given result. 129 // Send the appropriate IPC response to the renderer for the given result.
126 void SendIPCResponse(const std::string& uuid, 130 void SendIPCResponse(const std::string& uuid,
127 storage::BlobTransportResult result); 131 storage::BlobTransportResult result);
128 132
129 bool IsInUseInHost(const std::string& uuid); 133 bool IsInUseInHost(const std::string& uuid);
130 bool IsUrlRegisteredInHost(const GURL& blob_url); 134 bool IsUrlRegisteredInHost(const GURL& blob_url);
131 135
132 // Unregisters all blobs and urls that were registered in this host. 136 // Unregisters all blobs and urls that were registered in this host.
133 void ClearHostFromBlobStorageContext(); 137 void ClearHostFromBlobStorageContext();
134 138
139 const int process_id_;
140 scoped_refptr<storage::FileSystemContext> file_system_context_;
141
135 // Collection of blob ids and a count of how many usages 142 // Collection of blob ids and a count of how many usages
136 // of that id are attributable to this consumer. 143 // of that id are attributable to this consumer.
137 BlobReferenceMap blobs_inuse_map_; 144 BlobReferenceMap blobs_inuse_map_;
138 145
139 // The set of public blob urls coined by this consumer. 146 // The set of public blob urls coined by this consumer.
140 std::set<GURL> public_blob_urls_; 147 std::set<GURL> public_blob_urls_;
141 148
142 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 149 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
143 storage::BlobAsyncBuilderHost async_builder_; 150 storage::BlobAsyncBuilderHost async_builder_;
144 151
145 DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost); 152 DISALLOW_COPY_AND_ASSIGN(BlobDispatcherHost);
146 }; 153 };
147 } // namespace content 154 } // namespace content
148 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_ 155 #endif // CONTENT_BROWSER_BLOB_STORAGE_BLOB_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/blob_storage/blob_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698