| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class DOMException; | 38 class DOMException; |
| 39 class IDBDatabase; | 39 class IDBDatabase; |
| 40 class WebIDBDatabaseCallbacks; | 40 class WebIDBDatabaseCallbacks; |
| 41 struct WebIDBObservation; | 41 struct WebIDBObservation; |
| 42 | 42 |
| 43 class MODULES_EXPORT IDBDatabaseCallbacks | 43 class MODULES_EXPORT IDBDatabaseCallbacks |
| 44 : public GarbageCollectedFinalized<IDBDatabaseCallbacks> { | 44 : public GarbageCollectedFinalized<IDBDatabaseCallbacks> { |
| 45 public: | 45 public: |
| 46 // Maps observer to transaction, which needs an id and a scope. |
| 47 using TransactionMap = |
| 48 std::unordered_map<int32_t, std::pair<int64_t, std::vector<int64_t>>>; |
| 49 |
| 46 static IDBDatabaseCallbacks* create(); | 50 static IDBDatabaseCallbacks* create(); |
| 47 virtual ~IDBDatabaseCallbacks(); | 51 virtual ~IDBDatabaseCallbacks(); |
| 48 DECLARE_TRACE(); | 52 DECLARE_TRACE(); |
| 49 | 53 |
| 50 // IDBDatabaseCallbacks | 54 // IDBDatabaseCallbacks |
| 51 virtual void onForcedClose(); | 55 virtual void onForcedClose(); |
| 52 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); | 56 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 53 | 57 |
| 54 virtual void onAbort(int64_t transactionId, DOMException*); | 58 virtual void onAbort(int64_t transactionId, DOMException*); |
| 55 virtual void onComplete(int64_t transactionId); | 59 virtual void onComplete(int64_t transactionId); |
| 56 virtual void onChanges( | 60 virtual void onChanges( |
| 57 const std::unordered_map<int32_t, std::vector<int32_t>>& | 61 const std::unordered_map<int32_t, std::vector<int32_t>>& |
| 58 observation_index_map, | 62 observation_index_map, |
| 59 const WebVector<WebIDBObservation>& observations); | 63 const WebVector<WebIDBObservation>& observations, |
| 64 const TransactionMap& transactions); |
| 60 | 65 |
| 61 void connect(IDBDatabase*); | 66 void connect(IDBDatabase*); |
| 62 | 67 |
| 63 // Returns a new WebIDBDatabaseCallbacks for this object. Must only be | 68 // Returns a new WebIDBDatabaseCallbacks for this object. Must only be |
| 64 // called once. | 69 // called once. |
| 65 std::unique_ptr<WebIDBDatabaseCallbacks> createWebCallbacks(); | 70 std::unique_ptr<WebIDBDatabaseCallbacks> createWebCallbacks(); |
| 66 void detachWebCallbacks(); | 71 void detachWebCallbacks(); |
| 67 void webCallbacksDestroyed(); | 72 void webCallbacksDestroyed(); |
| 68 | 73 |
| 69 protected: | 74 protected: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 WeakMember<IDBDatabase> m_database; | 86 WeakMember<IDBDatabase> m_database; |
| 82 | 87 |
| 83 // Pointer back to the WebIDBDatabaseCallbacks that holds a persistent | 88 // Pointer back to the WebIDBDatabaseCallbacks that holds a persistent |
| 84 // reference to this object. | 89 // reference to this object. |
| 85 WebIDBDatabaseCallbacks* m_webCallbacks = nullptr; | 90 WebIDBDatabaseCallbacks* m_webCallbacks = nullptr; |
| 86 }; | 91 }; |
| 87 | 92 |
| 88 } // namespace blink | 93 } // namespace blink |
| 89 | 94 |
| 90 #endif // IDBDatabaseCallbacks_h | 95 #endif // IDBDatabaseCallbacks_h |
| OLD | NEW |