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

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

Issue 2784003002: [IndexedDB] Mojo testing harness. (Closed)
Patch Set: Working! Created 3 years, 7 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_DATABASE_CALLBACKS_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 26 matching lines...) Expand all
37 ::indexed_db::mojom::ObserverChangesPtr changes); 37 ::indexed_db::mojom::ObserverChangesPtr changes);
38 38
39 protected: 39 protected:
40 virtual ~IndexedDBDatabaseCallbacks(); 40 virtual ~IndexedDBDatabaseCallbacks();
41 41
42 private: 42 private:
43 friend class base::RefCounted<IndexedDBDatabaseCallbacks>; 43 friend class base::RefCounted<IndexedDBDatabaseCallbacks>;
44 44
45 class IOThreadHelper; 45 class IOThreadHelper;
46 46
47 // Required for unittests so that are scheduled on a taskrunner.
48 struct DeleteOnIOThreadTaskRunner {
49 template <typename T>
50 static void Destruct(const T* x) {
51 if (!BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, x)) {
52 #if defined(UNIT_TEST)
53 // Only logged under unit testing because leaks at shutdown
54 // are acceptable under normal circumstances.
55 LOG(ERROR) << "DeleteSoon failed on IO thread";
56 #endif // UNIT_TEST
57 }
58 }
59 template <typename T>
60 inline void operator()(T* ptr) const {
61 enum { type_must_be_complete = sizeof(T) };
62 Destruct(ptr);
63 }
64 };
65
47 bool complete_ = false; 66 bool complete_ = false;
48 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 67 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
49 std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_; 68 std::unique_ptr<IOThreadHelper, DeleteOnIOThreadTaskRunner> io_helper_;
50 base::ThreadChecker thread_checker_; 69 base::ThreadChecker thread_checker_;
51 70
52 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabaseCallbacks); 71 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabaseCallbacks);
53 }; 72 };
54 73
55 } // namespace content 74 } // namespace content
56 75
57 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ 76 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698