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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabaseCallbacks.h

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Require explicit wrapping when discarding map keys. Created 4 years, 2 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #define IDBDatabaseCallbacks_h 27 #define IDBDatabaseCallbacks_h
28 28
29 #include "modules/ModulesExport.h" 29 #include "modules/ModulesExport.h"
30 #include "platform/heap/Handle.h" 30 #include "platform/heap/Handle.h"
31 #include "wtf/PassRefPtr.h" 31 #include "wtf/PassRefPtr.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class DOMException; 35 class DOMException;
36 class IDBDatabase; 36 class IDBDatabase;
37 class WebIDBDatabaseCallbacks;
37 38
38 class MODULES_EXPORT IDBDatabaseCallbacks 39 class MODULES_EXPORT IDBDatabaseCallbacks
39 : public GarbageCollectedFinalized<IDBDatabaseCallbacks> { 40 : public GarbageCollectedFinalized<IDBDatabaseCallbacks> {
40 public: 41 public:
41 static IDBDatabaseCallbacks* create(); 42 static IDBDatabaseCallbacks* create();
42 virtual ~IDBDatabaseCallbacks(); 43 virtual ~IDBDatabaseCallbacks();
43 DECLARE_TRACE(); 44 DECLARE_TRACE();
44 45
45 // IDBDatabaseCallbacks 46 // IDBDatabaseCallbacks
46 virtual void onForcedClose(); 47 virtual void onForcedClose();
47 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); 48 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion);
48 49
49 virtual void onAbort(int64_t transactionId, DOMException*); 50 virtual void onAbort(int64_t transactionId, DOMException*);
50 virtual void onComplete(int64_t transactionId); 51 virtual void onComplete(int64_t transactionId);
51 52
52 void connect(IDBDatabase*); 53 void connect(IDBDatabase*);
53 54
55 // Returns a new WebIDBDatabaseCallbacks for this object. Must only be
56 // called once.
57 std::unique_ptr<WebIDBDatabaseCallbacks> createWebCallbacks();
58 void detachWebCallbacks();
59 void webCallbacksDestroyed();
60
54 protected: 61 protected:
55 // Exposed to subclasses for unit tests. 62 // Exposed to subclasses for unit tests.
56 IDBDatabaseCallbacks(); 63 IDBDatabaseCallbacks();
57 64
58 private: 65 private:
59 // The initial IDBOpenDBRequest, final IDBDatabase, and/or 66 // The initial IDBOpenDBRequest, final IDBDatabase, and/or
60 // WebIDBDatabaseCallbacks have strong references to an IDBDatabaseCallbacks 67 // WebIDBDatabaseCallbacks have strong references to an IDBDatabaseCallbacks
61 // object. 68 // object.
62 // Oilpan: We'd like to delete an IDBDatabase object by a 69 // Oilpan: We'd like to delete an IDBDatabase object by a
63 // GC. WebIDBDatabaseCallbacks can survive the GC, and IDBDatabaseCallbacks 70 // GC. WebIDBDatabaseCallbacks can survive the GC, and IDBDatabaseCallbacks
64 // can survive too. m_database should be a weak reference to avoid that an 71 // can survive too. m_database should be a weak reference to avoid that an
65 // IDBDatabase survives the GC with the IDBDatabaseCallbacks. 72 // IDBDatabase survives the GC with the IDBDatabaseCallbacks.
66 WeakMember<IDBDatabase> m_database; 73 WeakMember<IDBDatabase> m_database;
74
75 // Pointer back to the WebIDBDatabaseCallbacks that holds a persistent
76 // reference to this object.
77 WebIDBDatabaseCallbacks* m_webCallbacks = nullptr;
67 }; 78 };
68 79
69 } // namespace blink 80 } // namespace blink
70 81
71 #endif // IDBDatabaseCallbacks_h 82 #endif // IDBDatabaseCallbacks_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698