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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_callbacks.cc

Issue 17033004: Tell IDB frontend about data loss (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToT Created 7 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 | Annotate | Revision Log
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 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 5 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "content/browser/indexed_db/indexed_db_metadata.h" 10 #include "content/browser/indexed_db/indexed_db_metadata.h"
11 #include "content/browser/indexed_db/webidbdatabase_impl.h" 11 #include "content/browser/indexed_db/webidbdatabase_impl.h"
12 #include "content/common/indexed_db/indexed_db_messages.h" 12 #include "content/common/indexed_db/indexed_db_messages.h"
13 #include "webkit/browser/quota/quota_manager.h" 13 #include "webkit/browser/quota/quota_manager.h"
14 14
15 using WebKit::WebData; 15 using WebKit::WebData;
16 using WebKit::WebIDBCallbacks;
16 using WebKit::WebString; 17 using WebKit::WebString;
17 18
18 namespace content { 19 namespace content {
19 20
20 namespace { 21 namespace {
21 const int32 kDatabaseNotAdded = -1; 22 const int32 kDatabaseNotAdded = -1;
22 } 23 }
23 24
24 IndexedDBCallbacksBase::IndexedDBCallbacksBase( 25 IndexedDBCallbacksBase::IndexedDBCallbacksBase(
25 IndexedDBDispatcherHost* dispatcher_host, 26 IndexedDBDispatcherHost* dispatcher_host,
(...skipping 18 matching lines...) Expand all
44 void IndexedDBCallbacksBase::onSuccess(const std::vector<string16>& value) { 45 void IndexedDBCallbacksBase::onSuccess(const std::vector<string16>& value) {
45 NOTREACHED(); 46 NOTREACHED();
46 } 47 }
47 48
48 void IndexedDBCallbacksBase::onSuccess( 49 void IndexedDBCallbacksBase::onSuccess(
49 WebIDBDatabaseImpl* idb_object, 50 WebIDBDatabaseImpl* idb_object,
50 const IndexedDBDatabaseMetadata& metadata) { 51 const IndexedDBDatabaseMetadata& metadata) {
51 NOTREACHED(); 52 NOTREACHED();
52 } 53 }
53 54
54 void IndexedDBCallbacksBase::onUpgradeNeeded(long long old_version, 55 void IndexedDBCallbacksBase::onUpgradeNeeded(
55 WebIDBDatabaseImpl* database, 56 long long old_version,
56 const IndexedDBDatabaseMetadata&) { 57 WebIDBDatabaseImpl* database,
58 const IndexedDBDatabaseMetadata&,
jsbell 2013/06/17 23:21:48 Not new in this patch, but name the argument: /*me
dgrogan 2013/06/17 23:52:40 Done.
59 WebKit::WebIDBCallbacks::DataLoss data_loss) {
57 NOTREACHED(); 60 NOTREACHED();
58 } 61 }
59 62
60 void IndexedDBCallbacksBase::onSuccess(WebIDBCursorImpl* idb_object, 63 void IndexedDBCallbacksBase::onSuccess(WebIDBCursorImpl* idb_object,
61 const IndexedDBKey& key, 64 const IndexedDBKey& key,
62 const IndexedDBKey& primaryKey, 65 const IndexedDBKey& primaryKey,
63 std::vector<char>* value) { 66 std::vector<char>* value) {
64 NOTREACHED(); 67 NOTREACHED();
65 } 68 }
66 69
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 new IndexedDBMsg_CallbacksSuccessIDBDatabase(ipc_thread_id(), 129 new IndexedDBMsg_CallbacksSuccessIDBDatabase(ipc_thread_id(),
127 ipc_callbacks_id(), 130 ipc_callbacks_id(),
128 ipc_database_callbacks_id_, 131 ipc_database_callbacks_id_,
129 ipc_object_id, 132 ipc_object_id,
130 idb_metadata)); 133 idb_metadata));
131 } 134 }
132 135
133 void IndexedDBCallbacksDatabase::onUpgradeNeeded( 136 void IndexedDBCallbacksDatabase::onUpgradeNeeded(
134 long long old_version, 137 long long old_version,
135 WebIDBDatabaseImpl* database, 138 WebIDBDatabaseImpl* database,
136 const IndexedDBDatabaseMetadata& metadata) { 139 const IndexedDBDatabaseMetadata& metadata,
140 WebIDBCallbacks::DataLoss data_loss) {
137 dispatcher_host()->RegisterTransactionId(host_transaction_id_, origin_url_); 141 dispatcher_host()->RegisterTransactionId(host_transaction_id_, origin_url_);
138 int32 ipc_database_id = 142 int32 ipc_database_id =
139 dispatcher_host()->Add(database, ipc_thread_id(), origin_url_); 143 dispatcher_host()->Add(database, ipc_thread_id(), origin_url_);
140 ipc_database_id_ = ipc_database_id; 144 ipc_database_id_ = ipc_database_id;
141 IndexedDBMsg_CallbacksUpgradeNeeded_Params params; 145 IndexedDBMsg_CallbacksUpgradeNeeded_Params params;
142 params.ipc_thread_id = ipc_thread_id(); 146 params.ipc_thread_id = ipc_thread_id();
143 params.ipc_callbacks_id = ipc_callbacks_id(); 147 params.ipc_callbacks_id = ipc_callbacks_id();
144 params.ipc_database_id = ipc_database_id; 148 params.ipc_database_id = ipc_database_id;
145 params.ipc_database_callbacks_id = ipc_database_callbacks_id_; 149 params.ipc_database_callbacks_id = ipc_database_callbacks_id_;
146 params.old_version = old_version; 150 params.old_version = old_version;
147 params.idb_metadata = IndexedDBDispatcherHost::ConvertMetadata(metadata); 151 params.idb_metadata = IndexedDBDispatcherHost::ConvertMetadata(metadata);
152 params.data_loss = data_loss;
148 dispatcher_host()->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params)); 153 dispatcher_host()->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params));
149 } 154 }
150 155
151 void IndexedDBCallbacks<WebIDBCursorImpl>::onSuccess( 156 void IndexedDBCallbacks<WebIDBCursorImpl>::onSuccess(
152 WebIDBCursorImpl* idb_cursor, 157 WebIDBCursorImpl* idb_cursor,
153 const IndexedDBKey& key, 158 const IndexedDBKey& key,
154 const IndexedDBKey& primaryKey, 159 const IndexedDBKey& primaryKey,
155 std::vector<char>* value) { 160 std::vector<char>* value) {
156 int32 ipc_object_id = dispatcher_host()->Add(idb_cursor); 161 int32 ipc_object_id = dispatcher_host()->Add(idb_cursor);
157 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params; 162 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 ipc_thread_id(), ipc_callbacks_id())); 287 ipc_thread_id(), ipc_callbacks_id()));
283 } 288 }
284 289
285 void IndexedDBCallbacks<std::vector<char> >::onSuccess( 290 void IndexedDBCallbacks<std::vector<char> >::onSuccess(
286 const IndexedDBKey& value) { 291 const IndexedDBKey& value) {
287 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey( 292 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey(
288 ipc_thread_id(), ipc_callbacks_id(), value)); 293 ipc_thread_id(), ipc_callbacks_id(), value));
289 } 294 }
290 295
291 } // namespace content 296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698