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

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

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void IDBDatabaseCallbacks::onAbort(int64_t transactionId, DOMException* error) { 56 void IDBDatabaseCallbacks::onAbort(int64_t transactionId, DOMException* error) {
57 if (m_database) 57 if (m_database)
58 m_database->onAbort(transactionId, error); 58 m_database->onAbort(transactionId, error);
59 } 59 }
60 60
61 void IDBDatabaseCallbacks::onComplete(int64_t transactionId) { 61 void IDBDatabaseCallbacks::onComplete(int64_t transactionId) {
62 if (m_database) 62 if (m_database)
63 m_database->onComplete(transactionId); 63 m_database->onComplete(transactionId);
64 } 64 }
65 65
66 void IDBDatabaseCallbacks::onChanges(
67 const std::unordered_map<int32_t, std::vector<int32_t>>&
68 observation_index_map,
69 const WebVector<WebIDBObservation>& observations) {
70 if (m_database)
71 m_database->onChanges(observation_index_map, observations);
72 }
73
66 void IDBDatabaseCallbacks::connect(IDBDatabase* database) { 74 void IDBDatabaseCallbacks::connect(IDBDatabase* database) {
67 DCHECK(!m_database); 75 DCHECK(!m_database);
68 DCHECK(database); 76 DCHECK(database);
69 m_database = database; 77 m_database = database;
70 } 78 }
71 79
72 std::unique_ptr<WebIDBDatabaseCallbacks> 80 std::unique_ptr<WebIDBDatabaseCallbacks>
73 IDBDatabaseCallbacks::createWebCallbacks() { 81 IDBDatabaseCallbacks::createWebCallbacks() {
74 DCHECK(!m_webCallbacks); 82 DCHECK(!m_webCallbacks);
75 std::unique_ptr<WebIDBDatabaseCallbacks> callbacks = 83 std::unique_ptr<WebIDBDatabaseCallbacks> callbacks =
76 WebIDBDatabaseCallbacksImpl::create(this); 84 WebIDBDatabaseCallbacksImpl::create(this);
77 m_webCallbacks = callbacks.get(); 85 m_webCallbacks = callbacks.get();
78 return callbacks; 86 return callbacks;
79 } 87 }
80 88
81 void IDBDatabaseCallbacks::detachWebCallbacks() { 89 void IDBDatabaseCallbacks::detachWebCallbacks() {
82 if (m_webCallbacks) { 90 if (m_webCallbacks) {
83 m_webCallbacks->detach(); 91 m_webCallbacks->detach();
84 m_webCallbacks = nullptr; 92 m_webCallbacks = nullptr;
85 } 93 }
86 } 94 }
87 95
88 void IDBDatabaseCallbacks::webCallbacksDestroyed() { 96 void IDBDatabaseCallbacks::webCallbacksDestroyed() {
89 DCHECK(m_webCallbacks); 97 DCHECK(m_webCallbacks);
90 m_webCallbacks = nullptr; 98 m_webCallbacks = nullptr;
91 } 99 }
92 100
93 } // namespace blink 101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698