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

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.h

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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
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_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/common/indexed_db/indexed_db.mojom.h" 19 #include "content/common/indexed_db/indexed_db.mojom.h"
20 #include "content/public/browser/browser_associated_interface.h" 20 #include "content/public/browser/browser_associated_interface.h"
21 #include "content/public/browser/browser_message_filter.h" 21 #include "content/public/browser/browser_message_filter.h"
22 #include "net/url_request/url_request_context_getter.h" 22 #include "net/url_request/url_request_context_getter.h"
23 #include "storage/browser/blob/blob_data_handle.h" 23 #include "storage/browser/blob/blob_data_handle.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 struct IndexedDBHostMsg_DatabaseObserve_Params;
27 struct IndexedDBMsg_Observation;
28 struct IndexedDBMsg_ObserverChanges;
29
30 namespace url { 26 namespace url {
31 class Origin; 27 class Origin;
32 } 28 }
33 29
34 namespace content { 30 namespace content {
35 class IndexedDBBlobInfo; 31 class IndexedDBBlobInfo;
36 class IndexedDBCallbacks; 32 class IndexedDBCallbacks;
37 class IndexedDBConnection; 33 class IndexedDBConnection;
38 class IndexedDBContextImpl; 34 class IndexedDBContextImpl;
39 class IndexedDBDatabaseCallbacks; 35 class IndexedDBDatabaseCallbacks;
40 class IndexedDBObservation;
41 class IndexedDBObserverChanges;
42 36
43 // Handles all IndexedDB related messages from a particular renderer process. 37 // Handles all IndexedDB related messages from a particular renderer process.
44 class IndexedDBDispatcherHost 38 class IndexedDBDispatcherHost
45 : public BrowserMessageFilter, 39 : public BrowserMessageFilter,
46 public BrowserAssociatedInterface<::indexed_db::mojom::Factory>, 40 public BrowserAssociatedInterface<::indexed_db::mojom::Factory>,
47 public ::indexed_db::mojom::Factory { 41 public ::indexed_db::mojom::Factory {
48 public: 42 public:
49 // Only call the constructor from the UI thread. 43 // Only call the constructor from the UI thread.
50 IndexedDBDispatcherHost(int ipc_process_id, 44 IndexedDBDispatcherHost(int ipc_process_id,
51 net::URLRequestContextGetter* request_context_getter, 45 net::URLRequestContextGetter* request_context_getter,
52 IndexedDBContextImpl* indexed_db_context, 46 IndexedDBContextImpl* indexed_db_context,
53 ChromeBlobStorageContext* blob_storage_context); 47 ChromeBlobStorageContext* blob_storage_context);
54 48
55 static IndexedDBMsg_ObserverChanges ConvertObserverChanges(
56 std::unique_ptr<IndexedDBObserverChanges> changes);
57 static IndexedDBMsg_Observation ConvertObservation(
58 const IndexedDBObservation* observation);
59
60 // BrowserMessageFilter implementation. 49 // BrowserMessageFilter implementation.
61 void OnChannelClosing() override; 50 void OnChannelClosing() override;
62 void OnDestruct() const override; 51 void OnDestruct() const override;
63 bool OnMessageReceived(const IPC::Message& message) override; 52 bool OnMessageReceived(const IPC::Message& message) override;
64 53
65 void FinishTransaction(int64_t host_transaction_id, bool committed); 54 void FinishTransaction(int64_t host_transaction_id, bool committed);
66 55
67 // A shortcut for accessing our context. 56 // A shortcut for accessing our context.
68 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); } 57 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); }
69 storage::BlobStorageContext* blob_storage_context() const { 58 storage::BlobStorageContext* blob_storage_context() const {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Used in nested classes. 92 // Used in nested classes.
104 typedef std::map<int64_t, int64_t> TransactionIDToSizeMap; 93 typedef std::map<int64_t, int64_t> TransactionIDToSizeMap;
105 typedef std::map<int64_t, url::Origin> TransactionIDToOriginMap; 94 typedef std::map<int64_t, url::Origin> TransactionIDToOriginMap;
106 95
107 ~IndexedDBDispatcherHost() override; 96 ~IndexedDBDispatcherHost() override;
108 97
109 // indexed_db::mojom::Factory implementation: 98 // indexed_db::mojom::Factory implementation:
110 void GetDatabaseNames( 99 void GetDatabaseNames(
111 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, 100 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info,
112 const url::Origin& origin) override; 101 const url::Origin& origin) override;
113 void Open(int32_t worker_thread, 102 void Open(::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info,
114 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info,
115 ::indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo 103 ::indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo
116 database_callbacks_info, 104 database_callbacks_info,
117 const url::Origin& origin, 105 const url::Origin& origin,
118 const base::string16& name, 106 const base::string16& name,
119 int64_t version, 107 int64_t version,
120 int64_t transaction_id) override; 108 int64_t transaction_id) override;
121 void DeleteDatabase( 109 void DeleteDatabase(
122 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info, 110 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info,
123 const url::Origin& origin, 111 const url::Origin& origin,
124 const base::string16& name) override; 112 const base::string16& name) override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 144
157 // Used to set file permissions for blob storage. 145 // Used to set file permissions for blob storage.
158 int ipc_process_id_; 146 int ipc_process_id_;
159 147
160 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 148 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
161 }; 149 };
162 150
163 } // namespace content 151 } // namespace content
164 152
165 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 153 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698