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

Side by Side Diff: content/browser/indexed_db/indexed_db_callbacks_wrapper.cc

Issue 17033004: Tell IDB frontend about data loss (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h" 6 #include "content/browser/indexed_db/indexed_db_callbacks_wrapper.h"
7 #include "content/browser/indexed_db/indexed_db_cursor.h" 7 #include "content/browser/indexed_db/indexed_db_cursor.h"
8 #include "content/browser/indexed_db/indexed_db_metadata.h" 8 #include "content/browser/indexed_db/indexed_db_metadata.h"
9 #include "content/browser/indexed_db/webidbcursor_impl.h" 9 #include "content/browser/indexed_db/webidbcursor_impl.h"
10 #include "content/browser/indexed_db/webidbdatabase_impl.h" 10 #include "content/browser/indexed_db/webidbdatabase_impl.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 void IndexedDBCallbacksWrapper::OnBlocked(int64 existing_version) { 109 void IndexedDBCallbacksWrapper::OnBlocked(int64 existing_version) {
110 DCHECK(callbacks_); 110 DCHECK(callbacks_);
111 callbacks_->onBlocked(existing_version); 111 callbacks_->onBlocked(existing_version);
112 } 112 }
113 113
114 void IndexedDBCallbacksWrapper::OnUpgradeNeeded( 114 void IndexedDBCallbacksWrapper::OnUpgradeNeeded(
115 int64 old_version, 115 int64 old_version,
116 scoped_refptr<IndexedDBDatabase> database, 116 scoped_refptr<IndexedDBDatabase> database,
117 const IndexedDBDatabaseMetadata& metadata) { 117 const IndexedDBDatabaseMetadata& metadata,
118 bool data_loss) {
118 DCHECK(callbacks_); 119 DCHECK(callbacks_);
119 did_create_proxy_ = true; 120 did_create_proxy_ = true;
120 callbacks_->onUpgradeNeeded( 121 callbacks_->onUpgradeNeeded(
121 old_version, 122 old_version,
122 new WebIDBDatabaseImpl(database, database_callbacks_), 123 new WebIDBDatabaseImpl(database, database_callbacks_),
123 metadata); 124 metadata,
125 data_loss);
124 database_callbacks_ = NULL; 126 database_callbacks_ = NULL;
125 } 127 }
126 128
127 void IndexedDBCallbacksWrapper::OnSuccess( 129 void IndexedDBCallbacksWrapper::OnSuccess(
128 scoped_refptr<IndexedDBDatabase> database, 130 scoped_refptr<IndexedDBDatabase> database,
129 const IndexedDBDatabaseMetadata& metadata) { 131 const IndexedDBDatabaseMetadata& metadata) {
130 DCHECK(callbacks_); 132 DCHECK(callbacks_);
131 scoped_refptr<IndexedDBCallbacksWrapper> self(this); 133 scoped_refptr<IndexedDBCallbacksWrapper> self(this);
132 134
133 WebIDBDatabaseImpl* impl = 135 WebIDBDatabaseImpl* impl =
134 did_create_proxy_ ? 0 136 did_create_proxy_ ? 0
135 : new WebIDBDatabaseImpl(database, database_callbacks_); 137 : new WebIDBDatabaseImpl(database, database_callbacks_);
136 database_callbacks_ = NULL; 138 database_callbacks_ = NULL;
137 139
138 callbacks_->onSuccess(impl, metadata); 140 callbacks_->onSuccess(impl, metadata);
139 callbacks_.reset(); 141 callbacks_.reset();
140 } 142 }
141 143
142 void IndexedDBCallbacksWrapper::SetDatabaseCallbacks( 144 void IndexedDBCallbacksWrapper::SetDatabaseCallbacks(
143 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks) { 145 scoped_refptr<IndexedDBDatabaseCallbacksWrapper> database_callbacks) {
144 database_callbacks_ = database_callbacks; 146 database_callbacks_ = database_callbacks;
145 } 147 }
146 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698