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

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

Issue 2172863002: [IndexedDB]: Passing URLRequestContextGetter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a few missed merge conflicts. 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
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 <string> 12 #include <string>
12 #include <utility> 13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/id_map.h" 16 #include "base/id_map.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
19 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 20 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
20 #include "content/public/browser/browser_message_filter.h" 21 #include "content/public/browser/browser_message_filter.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 struct IndexedDBDatabaseMetadata; 60 struct IndexedDBDatabaseMetadata;
60 61
61 // Handles all IndexedDB related messages from a particular renderer process. 62 // Handles all IndexedDB related messages from a particular renderer process.
62 class IndexedDBDispatcherHost : public BrowserMessageFilter { 63 class IndexedDBDispatcherHost : public BrowserMessageFilter {
63 public: 64 public:
64 // Only call the constructor from the UI thread. 65 // Only call the constructor from the UI thread.
65 IndexedDBDispatcherHost(int ipc_process_id, 66 IndexedDBDispatcherHost(int ipc_process_id,
66 net::URLRequestContextGetter* request_context_getter, 67 net::URLRequestContextGetter* request_context_getter,
67 IndexedDBContextImpl* indexed_db_context, 68 IndexedDBContextImpl* indexed_db_context,
68 ChromeBlobStorageContext* blob_storage_context); 69 ChromeBlobStorageContext* blob_storage_context);
69 IndexedDBDispatcherHost(int ipc_process_id,
70 net::URLRequestContext* request_context,
71 IndexedDBContextImpl* indexed_db_context,
72 ChromeBlobStorageContext* blob_storage_context);
73 70
74 static ::IndexedDBDatabaseMetadata ConvertMetadata( 71 static ::IndexedDBDatabaseMetadata ConvertMetadata(
75 const content::IndexedDBDatabaseMetadata& metadata); 72 const content::IndexedDBDatabaseMetadata& metadata);
76 static IndexedDBMsg_ObserverChanges ConvertObserverChanges( 73 static IndexedDBMsg_ObserverChanges ConvertObserverChanges(
77 std::unique_ptr<IndexedDBObserverChanges> changes); 74 std::unique_ptr<IndexedDBObserverChanges> changes);
78 static IndexedDBMsg_Observation ConvertObservation( 75 static IndexedDBMsg_Observation ConvertObservation(
79 const IndexedDBObservation* observation); 76 const IndexedDBObservation* observation);
80 77
81 // BrowserMessageFilter implementation. 78 // BrowserMessageFilter implementation.
82 void OnChannelConnected(int32_t peer_pid) override;
83 void OnChannelClosing() override; 79 void OnChannelClosing() override;
84 void OnDestruct() const override; 80 void OnDestruct() const override;
85 base::TaskRunner* OverrideTaskRunnerForMessage( 81 base::TaskRunner* OverrideTaskRunnerForMessage(
86 const IPC::Message& message) override; 82 const IPC::Message& message) override;
87 bool OnMessageReceived(const IPC::Message& message) override; 83 bool OnMessageReceived(const IPC::Message& message) override;
88 84
89 void FinishTransaction(int64_t host_transaction_id, bool committed); 85 void FinishTransaction(int64_t host_transaction_id, bool committed);
90 86
91 // A shortcut for accessing our context. 87 // A shortcut for accessing our context.
92 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); } 88 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void OnIDBFactoryDeleteDatabase( 287 void OnIDBFactoryDeleteDatabase(
292 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); 288 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p);
293 289
294 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); 290 void OnAckReceivedBlobs(const std::vector<std::string>& uuids);
295 void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params, 291 void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params,
296 std::vector<storage::BlobDataHandle*> handles); 292 std::vector<storage::BlobDataHandle*> handles);
297 293
298 void ResetDispatcherHosts(); 294 void ResetDispatcherHosts();
299 void DropBlobData(const std::string& uuid); 295 void DropBlobData(const std::string& uuid);
300 296
301 // The getter holds the context until OnChannelConnected() can be called from
302 // the IO thread, which will extract the net::URLRequestContext from it.
303 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 297 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
304 net::URLRequestContext* request_context_;
305 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 298 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
306 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 299 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
307 300
308 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count 301 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count
309 // is incremented in HoldBlobData(), and count is decremented and/or entry 302 // is incremented in HoldBlobData(), and count is decremented and/or entry
310 // removed in DropBlobData(). 303 // removed in DropBlobData().
311 std::map<std::string, 304 std::map<std::string,
312 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> 305 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>>
313 blob_data_handle_map_; 306 blob_data_handle_map_;
314 307
315 // Only access on IndexedDB thread. 308 // Only access on IndexedDB thread.
316 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 309 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
317 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 310 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
318 311
319 // Used to set file permissions for blob storage. 312 // Used to set file permissions for blob storage.
320 int ipc_process_id_; 313 int ipc_process_id_;
321 314
322 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 315 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
323 }; 316 };
324 317
325 } // namespace content 318 } // namespace content
326 319
327 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 320 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698