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 "base/optional.h" |
18 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 19 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
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" |
22 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
23 #include "storage/browser/blob/blob_data_handle.h" | 24 #include "storage/browser/blob/blob_data_handle.h" |
24 | 25 |
25 namespace url { | 26 namespace url { |
26 class Origin; | 27 class Origin; |
27 } | 28 } |
(...skipping 29 matching lines...) Expand all Loading... |
57 void DropBlobData(const std::string& uuid); | 58 void DropBlobData(const std::string& uuid); |
58 | 59 |
59 private: | 60 private: |
60 // Friends to enable OnDestruct() delegation. | 61 // Friends to enable OnDestruct() delegation. |
61 friend class BrowserThread; | 62 friend class BrowserThread; |
62 friend class base::DeleteHelper<IndexedDBDispatcherHost>; | 63 friend class base::DeleteHelper<IndexedDBDispatcherHost>; |
63 | 64 |
64 ~IndexedDBDispatcherHost() override; | 65 ~IndexedDBDispatcherHost() override; |
65 | 66 |
66 // indexed_db::mojom::Factory implementation: | 67 // indexed_db::mojom::Factory implementation: |
| 68 void Configure( |
| 69 const IndexedDBDataFormatVersion& client_data_format_version) override; |
67 void GetDatabaseNames( | 70 void GetDatabaseNames( |
68 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, | 71 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, |
69 const url::Origin& origin) override; | 72 const url::Origin& origin) override; |
70 void Open(::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, | 73 void Open(::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, |
71 ::indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo | 74 ::indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo |
72 database_callbacks_info, | 75 database_callbacks_info, |
73 const url::Origin& origin, | 76 const url::Origin& origin, |
74 const base::string16& name, | 77 const base::string16& name, |
75 int64_t version, | 78 int64_t version, |
76 int64_t transaction_id) override; | 79 int64_t transaction_id) override; |
77 void DeleteDatabase( | 80 void DeleteDatabase( |
78 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, | 81 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, |
79 const url::Origin& origin, | 82 const url::Origin& origin, |
80 const base::string16& name, | 83 const base::string16& name, |
81 bool force_close) override; | 84 bool force_close) override; |
82 | 85 |
| 86 void ConfigureOnIDBThread( |
| 87 const IndexedDBDataFormatVersion& client_data_format_version); |
83 void GetDatabaseNamesOnIDBThread(scoped_refptr<IndexedDBCallbacks> callbacks, | 88 void GetDatabaseNamesOnIDBThread(scoped_refptr<IndexedDBCallbacks> callbacks, |
84 const url::Origin& origin); | 89 const url::Origin& origin); |
85 void OpenOnIDBThread( | 90 void OpenOnIDBThread( |
86 scoped_refptr<IndexedDBCallbacks> callbacks, | 91 scoped_refptr<IndexedDBCallbacks> callbacks, |
87 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 92 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
88 const url::Origin& origin, | 93 const url::Origin& origin, |
89 const base::string16& name, | 94 const base::string16& name, |
90 int64_t version, | 95 int64_t version, |
91 int64_t transaction_id); | 96 int64_t transaction_id); |
92 void DeleteDatabaseOnIDBThread(scoped_refptr<IndexedDBCallbacks> callbacks, | 97 void DeleteDatabaseOnIDBThread(scoped_refptr<IndexedDBCallbacks> callbacks, |
(...skipping 10 matching lines...) Expand all Loading... |
103 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count | 108 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count |
104 // is incremented in HoldBlobData(), and count is decremented and/or entry | 109 // is incremented in HoldBlobData(), and count is decremented and/or entry |
105 // removed in DropBlobData(). | 110 // removed in DropBlobData(). |
106 std::map<std::string, | 111 std::map<std::string, |
107 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> | 112 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> |
108 blob_data_handle_map_; | 113 blob_data_handle_map_; |
109 | 114 |
110 // Used to set file permissions for blob storage. | 115 // Used to set file permissions for blob storage. |
111 const int ipc_process_id_; | 116 const int ipc_process_id_; |
112 | 117 |
| 118 // The reported data format version supported by the client, used when opening |
| 119 // the backing store. Only accessed on the IDB thread. |
| 120 base::Optional<IndexedDBDataFormatVersion> client_data_format_version_; |
| 121 |
113 mojo::AssociatedBindingSet<::indexed_db::mojom::Factory> bindings_; | 122 mojo::AssociatedBindingSet<::indexed_db::mojom::Factory> bindings_; |
114 | 123 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 124 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
116 }; | 125 }; |
117 | 126 |
118 } // namespace content | 127 } // namespace content |
119 | 128 |
120 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 129 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |