OLD | NEW |
---|---|
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_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 18 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
19 #include "content/browser/indexed_db/database_impl.h" | |
Reilly Grant (use Gerrit)
2017/03/04 01:26:14
This include is unnecessary.
dmurph
2017/03/09 20:44:15
Done.
| |
19 #include "content/common/indexed_db/indexed_db.mojom.h" | 20 #include "content/common/indexed_db/indexed_db.mojom.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "mojo/public/cpp/bindings/associated_binding_set.h" | 22 #include "mojo/public/cpp/bindings/associated_binding_set.h" |
23 #include "mojo/public/cpp/bindings/strong_associated_binding_set.h" | |
22 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
23 #include "storage/browser/blob/blob_data_handle.h" | 25 #include "storage/browser/blob/blob_data_handle.h" |
24 | 26 |
25 namespace url { | 27 namespace url { |
26 class Origin; | 28 class Origin; |
27 } | 29 } |
28 | 30 |
29 namespace content { | 31 namespace content { |
30 class IndexedDBBlobInfo; | 32 class IndexedDBBlobInfo; |
31 class IndexedDBCallbacks; | 33 class IndexedDBCallbacks; |
32 class IndexedDBContextImpl; | 34 class IndexedDBContextImpl; |
33 class IndexedDBDatabaseCallbacks; | 35 class IndexedDBDatabaseCallbacks; |
34 | 36 |
35 // Handles all IndexedDB related messages from a particular renderer process. | 37 // Handles all IndexedDB related messages from a particular renderer process. |
36 class IndexedDBDispatcherHost | 38 class IndexedDBDispatcherHost |
37 : public base::RefCountedThreadSafe<IndexedDBDispatcherHost, | 39 : public base::RefCountedThreadSafe<IndexedDBDispatcherHost, |
38 BrowserThread::DeleteOnIOThread>, | 40 BrowserThread::DeleteOnIOThread>, |
39 public ::indexed_db::mojom::Factory { | 41 public ::indexed_db::mojom::Factory { |
40 public: | 42 public: |
41 // Only call the constructor from the UI thread. | 43 // Only call the constructor from the UI thread. |
42 IndexedDBDispatcherHost(int ipc_process_id, | 44 IndexedDBDispatcherHost(int ipc_process_id, |
43 net::URLRequestContextGetter* request_context_getter, | 45 net::URLRequestContextGetter* request_context_getter, |
44 IndexedDBContextImpl* indexed_db_context, | 46 IndexedDBContextImpl* indexed_db_context, |
45 ChromeBlobStorageContext* blob_storage_context); | 47 ChromeBlobStorageContext* blob_storage_context); |
46 | 48 |
47 void AddBinding(::indexed_db::mojom::FactoryAssociatedRequest request); | 49 void AddBinding(::indexed_db::mojom::FactoryAssociatedRequest request); |
48 | 50 |
51 void AddDatabaseBinding( | |
52 std::unique_ptr<::indexed_db::mojom::Database> database, | |
53 ::indexed_db::mojom::DatabaseAssociatedRequest request); | |
54 | |
55 void AddCursorBinding(std::unique_ptr<::indexed_db::mojom::Cursor> cursor, | |
56 ::indexed_db::mojom::CursorAssociatedRequest request); | |
57 | |
49 // A shortcut for accessing our context. | 58 // A shortcut for accessing our context. |
50 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); } | 59 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); } |
51 storage::BlobStorageContext* blob_storage_context() const { | 60 storage::BlobStorageContext* blob_storage_context() const { |
52 return blob_storage_context_->context(); | 61 return blob_storage_context_->context(); |
53 } | 62 } |
54 int ipc_process_id() const { return ipc_process_id_; } | 63 int ipc_process_id() const { return ipc_process_id_; } |
55 | 64 |
56 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); | 65 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); |
57 void DropBlobData(const std::string& uuid); | 66 void DropBlobData(const std::string& uuid); |
58 | 67 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 // removed in DropBlobData(). | 114 // removed in DropBlobData(). |
106 std::map<std::string, | 115 std::map<std::string, |
107 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> | 116 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> |
108 blob_data_handle_map_; | 117 blob_data_handle_map_; |
109 | 118 |
110 // Used to set file permissions for blob storage. | 119 // Used to set file permissions for blob storage. |
111 const int ipc_process_id_; | 120 const int ipc_process_id_; |
112 | 121 |
113 mojo::AssociatedBindingSet<::indexed_db::mojom::Factory> bindings_; | 122 mojo::AssociatedBindingSet<::indexed_db::mojom::Factory> bindings_; |
114 | 123 |
124 mojo::StrongAssociatedBindingSet<::indexed_db::mojom::Database> | |
125 database_bindings_; | |
126 | |
127 mojo::StrongAssociatedBindingSet<::indexed_db::mojom::Cursor> | |
128 cursor_bindings_; | |
129 | |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 130 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
116 }; | 131 }; |
117 | 132 |
118 } // namespace content | 133 } // namespace content |
119 | 134 |
120 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 135 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |