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

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

Issue 1504033007: Move Indexed DB from dedicated thread to task scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timer
Patch Set: Tweak traits Created 3 years, 6 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_CALLBACKS_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/sequence_checker.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "base/threading/thread_checker.h"
19 #include "content/browser/indexed_db/indexed_db_database_error.h" 19 #include "content/browser/indexed_db/indexed_db_database_error.h"
20 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 20 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
21 #include "content/common/indexed_db/indexed_db.mojom.h" 21 #include "content/common/indexed_db/indexed_db.mojom.h"
22 #include "content/common/indexed_db/indexed_db_key.h" 22 #include "content/common/indexed_db/indexed_db_key.h"
23 #include "content/common/indexed_db/indexed_db_key_path.h" 23 #include "content/common/indexed_db/indexed_db_key_path.h"
24 #include "url/origin.h" 24 #include "url/origin.h"
25 25
26 namespace base { 26 namespace base {
27 class SequencedTaskRunner; 27 class SequencedTaskRunner;
28 } 28 }
29 29
30 namespace content { 30 namespace content {
31 class IndexedDBConnection; 31 class IndexedDBConnection;
32 class IndexedDBCursor; 32 class IndexedDBCursor;
33 class IndexedDBDatabase; 33 class IndexedDBDatabase;
34 struct IndexedDBDataLossInfo; 34 struct IndexedDBDataLossInfo;
35 struct IndexedDBDatabaseMetadata; 35 struct IndexedDBDatabaseMetadata;
36 struct IndexedDBReturnValue; 36 struct IndexedDBReturnValue;
37 struct IndexedDBValue; 37 struct IndexedDBValue;
38 38
39 // Expected to be constructed on IO thread and called/deleted from IDB thread. 39 // Expected to be constructed on IO thread and called/deleted from IDB sequence.
40 class CONTENT_EXPORT IndexedDBCallbacks 40 class CONTENT_EXPORT IndexedDBCallbacks
41 : public base::RefCounted<IndexedDBCallbacks> { 41 : public base::RefCounted<IndexedDBCallbacks> {
42 public: 42 public:
43 // Destructively converts an IndexedDBValue to a Mojo Value. 43 // Destructively converts an IndexedDBValue to a Mojo Value.
44 static ::indexed_db::mojom::ValuePtr ConvertAndEraseValue( 44 static ::indexed_db::mojom::ValuePtr ConvertAndEraseValue(
45 IndexedDBValue* value); 45 IndexedDBValue* value);
46 46
47 IndexedDBCallbacks( 47 IndexedDBCallbacks(
48 base::WeakPtr<IndexedDBDispatcherHost> dispatcher_host, 48 base::WeakPtr<IndexedDBDispatcherHost> dispatcher_host,
49 const url::Origin& origin, 49 const url::Origin& origin,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 bool connection_created_ = false; 121 bool connection_created_ = false;
122 122
123 // Used to assert that OnSuccess is only called if there was no data loss. 123 // Used to assert that OnSuccess is only called if there was no data loss.
124 blink::WebIDBDataLoss data_loss_; 124 blink::WebIDBDataLoss data_loss_;
125 125
126 // The "blocked" event should be sent at most once per request. 126 // The "blocked" event should be sent at most once per request.
127 bool sent_blocked_ = false; 127 bool sent_blocked_ = false;
128 base::TimeTicks connection_open_start_time_; 128 base::TimeTicks connection_open_start_time_;
129 129
130 std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_; 130 std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_;
131 base::ThreadChecker thread_checker_; 131 SEQUENCE_CHECKER(sequence_checker_);
132 132
133 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks); 133 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacks);
134 }; 134 };
135 135
136 } // namespace content 136 } // namespace content
137 137
138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ 138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.cc ('k') | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698