Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_callbacks.cc
blobaa5497376f415566b8f1c6b4326c8fd92ff86371
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
3 // found in the LICENSE file.
5 #include "content/browser/indexed_db/indexed_db_callbacks.h"
7 #include <algorithm>
9 #include "base/metrics/histogram.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h"
12 #include "content/browser/child_process_security_policy_impl.h"
13 #include "content/browser/fileapi/fileapi_message_filter.h"
14 #include "content/browser/indexed_db/indexed_db_blob_info.h"
15 #include "content/browser/indexed_db/indexed_db_connection.h"
16 #include "content/browser/indexed_db/indexed_db_context_impl.h"
17 #include "content/browser/indexed_db/indexed_db_cursor.h"
18 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
19 #include "content/browser/indexed_db/indexed_db_database_error.h"
20 #include "content/browser/indexed_db/indexed_db_metadata.h"
21 #include "content/browser/indexed_db/indexed_db_return_value.h"
22 #include "content/browser/indexed_db/indexed_db_value.h"
23 #include "content/common/indexed_db/indexed_db_constants.h"
24 #include "content/common/indexed_db/indexed_db_messages.h"
25 #include "storage/browser/blob/blob_storage_context.h"
26 #include "storage/browser/blob/shareable_file_reference.h"
27 #include "storage/browser/quota/quota_manager.h"
29 using storage::ShareableFileReference;
31 namespace content {
33 namespace {
34 const int32 kNoCursor = -1;
35 const int32 kNoDatabaseCallbacks = -1;
36 const int64 kNoTransaction = -1;
39 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
40 int32 ipc_thread_id,
41 int32 ipc_callbacks_id)
42 : dispatcher_host_(dispatcher_host),
43 ipc_callbacks_id_(ipc_callbacks_id),
44 ipc_thread_id_(ipc_thread_id),
45 ipc_cursor_id_(kNoCursor),
46 host_transaction_id_(kNoTransaction),
47 ipc_database_id_(kNoDatabase),
48 ipc_database_callbacks_id_(kNoDatabaseCallbacks),
49 data_loss_(blink::WebIDBDataLossNone),
50 sent_blocked_(false) {
53 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
54 int32 ipc_thread_id,
55 int32 ipc_callbacks_id,
56 int32 ipc_cursor_id)
57 : dispatcher_host_(dispatcher_host),
58 ipc_callbacks_id_(ipc_callbacks_id),
59 ipc_thread_id_(ipc_thread_id),
60 ipc_cursor_id_(ipc_cursor_id),
61 host_transaction_id_(kNoTransaction),
62 ipc_database_id_(kNoDatabase),
63 ipc_database_callbacks_id_(kNoDatabaseCallbacks),
64 data_loss_(blink::WebIDBDataLossNone),
65 sent_blocked_(false) {
68 IndexedDBCallbacks::IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
69 int32 ipc_thread_id,
70 int32 ipc_callbacks_id,
71 int32 ipc_database_callbacks_id,
72 int64 host_transaction_id,
73 const GURL& origin_url)
74 : dispatcher_host_(dispatcher_host),
75 ipc_callbacks_id_(ipc_callbacks_id),
76 ipc_thread_id_(ipc_thread_id),
77 ipc_cursor_id_(kNoCursor),
78 host_transaction_id_(host_transaction_id),
79 origin_url_(origin_url),
80 ipc_database_id_(kNoDatabase),
81 ipc_database_callbacks_id_(ipc_database_callbacks_id),
82 data_loss_(blink::WebIDBDataLossNone),
83 sent_blocked_(false) {
86 IndexedDBCallbacks::~IndexedDBCallbacks() {}
88 void IndexedDBCallbacks::OnError(const IndexedDBDatabaseError& error) {
89 DCHECK(dispatcher_host_.get());
91 dispatcher_host_->Send(new IndexedDBMsg_CallbacksError(
92 ipc_thread_id_, ipc_callbacks_id_, error.code(), error.message()));
93 dispatcher_host_ = NULL;
95 if (!connection_open_start_time_.is_null()) {
96 UMA_HISTOGRAM_MEDIUM_TIMES(
97 "WebCore.IndexedDB.OpenTime.Error",
98 base::TimeTicks::Now() - connection_open_start_time_);
99 connection_open_start_time_ = base::TimeTicks();
103 void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) {
104 DCHECK(dispatcher_host_.get());
106 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
107 DCHECK_EQ(kNoTransaction, host_transaction_id_);
108 DCHECK_EQ(kNoDatabase, ipc_database_id_);
109 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
110 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
112 std::vector<base::string16> list;
113 for (unsigned i = 0; i < value.size(); ++i)
114 list.push_back(value[i]);
116 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessStringList(
117 ipc_thread_id_, ipc_callbacks_id_, list));
118 dispatcher_host_ = NULL;
121 void IndexedDBCallbacks::OnBlocked(int64 existing_version) {
122 DCHECK(dispatcher_host_.get());
124 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
125 // No transaction/db callbacks for DeleteDatabase.
126 DCHECK_EQ(kNoTransaction == host_transaction_id_,
127 kNoDatabaseCallbacks == ipc_database_callbacks_id_);
128 DCHECK_EQ(kNoDatabase, ipc_database_id_);
130 if (sent_blocked_)
131 return;
133 sent_blocked_ = true;
134 dispatcher_host_->Send(new IndexedDBMsg_CallbacksIntBlocked(
135 ipc_thread_id_, ipc_callbacks_id_, existing_version));
137 if (!connection_open_start_time_.is_null()) {
138 UMA_HISTOGRAM_MEDIUM_TIMES(
139 "WebCore.IndexedDB.OpenTime.Blocked",
140 base::TimeTicks::Now() - connection_open_start_time_);
141 connection_open_start_time_ = base::TimeTicks();
145 void IndexedDBCallbacks::OnDataLoss(blink::WebIDBDataLoss data_loss,
146 std::string data_loss_message) {
147 DCHECK_NE(blink::WebIDBDataLossNone, data_loss);
148 data_loss_ = data_loss;
149 data_loss_message_ = data_loss_message;
152 void IndexedDBCallbacks::OnUpgradeNeeded(
153 int64 old_version,
154 scoped_ptr<IndexedDBConnection> connection,
155 const IndexedDBDatabaseMetadata& metadata) {
156 DCHECK(dispatcher_host_.get());
158 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
159 DCHECK_NE(kNoTransaction, host_transaction_id_);
160 DCHECK_EQ(kNoDatabase, ipc_database_id_);
161 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
163 dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_url_);
164 int32 ipc_database_id =
165 dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_url_);
166 if (ipc_database_id < 0)
167 return;
168 ipc_database_id_ = ipc_database_id;
169 IndexedDBMsg_CallbacksUpgradeNeeded_Params params;
170 params.ipc_thread_id = ipc_thread_id_;
171 params.ipc_callbacks_id = ipc_callbacks_id_;
172 params.ipc_database_id = ipc_database_id;
173 params.ipc_database_callbacks_id = ipc_database_callbacks_id_;
174 params.old_version = old_version;
175 params.idb_metadata = IndexedDBDispatcherHost::ConvertMetadata(metadata);
176 params.data_loss = data_loss_;
177 params.data_loss_message = data_loss_message_;
178 dispatcher_host_->Send(new IndexedDBMsg_CallbacksUpgradeNeeded(params));
180 if (!connection_open_start_time_.is_null()) {
181 UMA_HISTOGRAM_MEDIUM_TIMES(
182 "WebCore.IndexedDB.OpenTime.UpgradeNeeded",
183 base::TimeTicks::Now() - connection_open_start_time_);
184 connection_open_start_time_ = base::TimeTicks();
188 void IndexedDBCallbacks::OnSuccess(scoped_ptr<IndexedDBConnection> connection,
189 const IndexedDBDatabaseMetadata& metadata) {
190 DCHECK(dispatcher_host_.get());
192 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
193 DCHECK_NE(kNoTransaction, host_transaction_id_);
194 DCHECK_NE(ipc_database_id_ == kNoDatabase, !connection);
195 DCHECK_NE(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
197 scoped_refptr<IndexedDBCallbacks> self(this);
199 int32 ipc_object_id = kNoDatabase;
200 // Only register if the connection was not previously sent in OnUpgradeNeeded.
201 if (ipc_database_id_ == kNoDatabase) {
202 ipc_object_id = dispatcher_host_->Add(
203 connection.release(), ipc_thread_id_, origin_url_);
206 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIDBDatabase(
207 ipc_thread_id_,
208 ipc_callbacks_id_,
209 ipc_database_callbacks_id_,
210 ipc_object_id,
211 IndexedDBDispatcherHost::ConvertMetadata(metadata)));
212 dispatcher_host_ = NULL;
214 if (!connection_open_start_time_.is_null()) {
215 UMA_HISTOGRAM_MEDIUM_TIMES(
216 "WebCore.IndexedDB.OpenTime.Success",
217 base::TimeTicks::Now() - connection_open_start_time_);
218 connection_open_start_time_ = base::TimeTicks();
222 static std::string CreateBlobData(
223 const IndexedDBBlobInfo& blob_info,
224 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
225 base::TaskRunner* task_runner) {
226 if (!blob_info.uuid().empty()) {
227 // We're sending back a live blob, not a reference into our backing store.
228 return dispatcher_host->HoldBlobData(blob_info);
230 scoped_refptr<ShareableFileReference> shareable_file =
231 ShareableFileReference::Get(blob_info.file_path());
232 if (!shareable_file.get()) {
233 shareable_file = ShareableFileReference::GetOrCreate(
234 blob_info.file_path(),
235 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE,
236 task_runner);
237 if (!blob_info.release_callback().is_null())
238 shareable_file->AddFinalReleaseCallback(blob_info.release_callback());
240 return dispatcher_host->HoldBlobData(blob_info);
243 static bool CreateAllBlobs(
244 const std::vector<IndexedDBBlobInfo>& blob_info,
245 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info,
246 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) {
247 DCHECK_EQ(blob_info.size(), blob_or_file_info->size());
248 size_t i;
249 if (!dispatcher_host->blob_storage_context())
250 return false;
251 for (i = 0; i < blob_info.size(); ++i) {
252 (*blob_or_file_info)[i].uuid =
253 CreateBlobData(blob_info[i],
254 dispatcher_host,
255 dispatcher_host->Context()->TaskRunner());
257 return true;
260 template <class ParamType, class MsgType>
261 static void CreateBlobsAndSend(
262 ParamType* params,
263 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
264 const std::vector<IndexedDBBlobInfo>& blob_info,
265 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info) {
266 DCHECK_CURRENTLY_ON(BrowserThread::IO);
267 if (CreateAllBlobs(blob_info, blob_or_file_info, dispatcher_host))
268 dispatcher_host->Send(new MsgType(*params));
271 static void BlobLookupForCursorPrefetch(
272 IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params* params,
273 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
274 const std::vector<IndexedDBValue>& values) {
275 DCHECK_CURRENTLY_ON(BrowserThread::IO);
276 DCHECK_EQ(values.size(), params->values.size());
278 for (size_t i = 0; i < values.size(); ++i) {
279 if (!CreateAllBlobs(values[i].blob_info,
280 &params->values[i].blob_or_file_info, dispatcher_host))
281 return;
284 dispatcher_host->Send(
285 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params));
288 static void FillInBlobData(
289 const std::vector<IndexedDBBlobInfo>& blob_info,
290 std::vector<IndexedDBMsg_BlobOrFileInfo>* blob_or_file_info) {
291 for (const auto& iter : blob_info) {
292 if (iter.is_file()) {
293 IndexedDBMsg_BlobOrFileInfo info;
294 info.is_file = true;
295 info.mime_type = iter.type();
296 info.file_name = iter.file_name();
297 info.file_path = iter.file_path().AsUTF16Unsafe();
298 info.size = iter.size();
299 info.last_modified = iter.last_modified().ToDoubleT();
300 blob_or_file_info->push_back(info);
301 } else {
302 IndexedDBMsg_BlobOrFileInfo info;
303 info.mime_type = iter.type();
304 info.size = iter.size();
305 blob_or_file_info->push_back(info);
310 void IndexedDBCallbacks::RegisterBlobsAndSend(
311 const std::vector<IndexedDBBlobInfo>& blob_info,
312 const base::Closure& callback) {
313 for (const auto& iter : blob_info) {
314 if (!iter.mark_used_callback().is_null())
315 iter.mark_used_callback().Run();
317 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
318 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback);
321 void IndexedDBCallbacks::OnSuccess(scoped_refptr<IndexedDBCursor> cursor,
322 const IndexedDBKey& key,
323 const IndexedDBKey& primary_key,
324 IndexedDBValue* value) {
325 DCHECK(dispatcher_host_.get());
327 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
328 DCHECK_EQ(kNoTransaction, host_transaction_id_);
329 DCHECK_EQ(kNoDatabase, ipc_database_id_);
330 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
331 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
333 int32 ipc_object_id = dispatcher_host_->Add(cursor.get());
334 scoped_ptr<IndexedDBMsg_CallbacksSuccessIDBCursor_Params> params(
335 new IndexedDBMsg_CallbacksSuccessIDBCursor_Params());
336 params->ipc_thread_id = ipc_thread_id_;
337 params->ipc_callbacks_id = ipc_callbacks_id_;
338 params->ipc_cursor_id = ipc_object_id;
339 params->key = key;
340 params->primary_key = primary_key;
341 if (value && !value->empty())
342 std::swap(params->value.bits, value->bits);
343 // TODO(alecflett): Avoid a copy here: the whole params object is
344 // being copied into the message.
345 if (!value || value->blob_info.empty()) {
346 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(*params));
347 } else {
348 IndexedDBMsg_CallbacksSuccessIDBCursor_Params* p = params.get();
349 FillInBlobData(value->blob_info, &p->value.blob_or_file_info);
350 RegisterBlobsAndSend(
351 value->blob_info,
352 base::Bind(
353 CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessIDBCursor_Params,
354 IndexedDBMsg_CallbacksSuccessIDBCursor>,
355 base::Owned(params.release()), dispatcher_host_, value->blob_info,
356 base::Unretained(&p->value.blob_or_file_info)));
358 dispatcher_host_ = NULL;
361 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& key,
362 const IndexedDBKey& primary_key,
363 IndexedDBValue* value) {
364 DCHECK(dispatcher_host_.get());
366 DCHECK_NE(kNoCursor, ipc_cursor_id_);
367 DCHECK_EQ(kNoTransaction, host_transaction_id_);
368 DCHECK_EQ(kNoDatabase, ipc_database_id_);
369 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
370 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
372 IndexedDBCursor* idb_cursor =
373 dispatcher_host_->GetCursorFromId(ipc_cursor_id_);
375 DCHECK(idb_cursor);
376 if (!idb_cursor)
377 return;
379 scoped_ptr<IndexedDBMsg_CallbacksSuccessCursorContinue_Params> params(
380 new IndexedDBMsg_CallbacksSuccessCursorContinue_Params());
381 params->ipc_thread_id = ipc_thread_id_;
382 params->ipc_callbacks_id = ipc_callbacks_id_;
383 params->ipc_cursor_id = ipc_cursor_id_;
384 params->key = key;
385 params->primary_key = primary_key;
386 if (value && !value->empty())
387 std::swap(params->value.bits, value->bits);
388 // TODO(alecflett): Avoid a copy here: the whole params object is
389 // being copied into the message.
390 if (!value || value->blob_info.empty()) {
391 dispatcher_host_->Send(
392 new IndexedDBMsg_CallbacksSuccessCursorContinue(*params));
393 } else {
394 IndexedDBMsg_CallbacksSuccessCursorContinue_Params* p = params.get();
395 FillInBlobData(value->blob_info, &p->value.blob_or_file_info);
396 RegisterBlobsAndSend(
397 value->blob_info,
398 base::Bind(CreateBlobsAndSend<
399 IndexedDBMsg_CallbacksSuccessCursorContinue_Params,
400 IndexedDBMsg_CallbacksSuccessCursorContinue>,
401 base::Owned(params.release()), dispatcher_host_,
402 value->blob_info,
403 base::Unretained(&p->value.blob_or_file_info)));
405 dispatcher_host_ = NULL;
408 void IndexedDBCallbacks::OnSuccessWithPrefetch(
409 const std::vector<IndexedDBKey>& keys,
410 const std::vector<IndexedDBKey>& primary_keys,
411 std::vector<IndexedDBValue>* values) {
412 DCHECK_EQ(keys.size(), primary_keys.size());
413 DCHECK_EQ(keys.size(), values->size());
415 DCHECK(dispatcher_host_.get());
417 DCHECK_NE(kNoCursor, ipc_cursor_id_);
418 DCHECK_EQ(kNoTransaction, host_transaction_id_);
419 DCHECK_EQ(kNoDatabase, ipc_database_id_);
420 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
421 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
423 std::vector<IndexedDBKey> msg_keys;
424 std::vector<IndexedDBKey> msg_primary_keys;
426 for (size_t i = 0; i < keys.size(); ++i) {
427 msg_keys.push_back(keys[i]);
428 msg_primary_keys.push_back(primary_keys[i]);
431 scoped_ptr<IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params> params(
432 new IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params());
433 params->ipc_thread_id = ipc_thread_id_;
434 params->ipc_callbacks_id = ipc_callbacks_id_;
435 params->ipc_cursor_id = ipc_cursor_id_;
436 params->keys = msg_keys;
437 params->primary_keys = msg_primary_keys;
438 params->values.resize(values->size());
440 bool found_blob_info = false;
441 for (size_t i = 0; i < values->size(); ++i) {
442 params->values[i].bits.swap(values->at(i).bits);
443 if (!values->at(i).blob_info.empty()) {
444 found_blob_info = true;
445 FillInBlobData(values->at(i).blob_info,
446 &params->values[i].blob_or_file_info);
447 for (const auto& blob_iter : values->at(i).blob_info) {
448 if (!blob_iter.mark_used_callback().is_null())
449 blob_iter.mark_used_callback().Run();
454 if (found_blob_info) {
455 BrowserThread::PostTask(BrowserThread::IO,
456 FROM_HERE,
457 base::Bind(BlobLookupForCursorPrefetch,
458 base::Owned(params.release()),
459 dispatcher_host_,
460 *values));
461 } else {
462 dispatcher_host_->Send(
463 new IndexedDBMsg_CallbacksSuccessCursorPrefetch(*params.get()));
465 dispatcher_host_ = NULL;
468 void IndexedDBCallbacks::OnSuccess(IndexedDBReturnValue* value) {
469 DCHECK(dispatcher_host_.get());
471 if (value && value->primary_key.IsValid()) {
472 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
473 } else {
474 DCHECK(kNoCursor == ipc_cursor_id_ || value == NULL);
476 DCHECK_EQ(kNoTransaction, host_transaction_id_);
477 DCHECK_EQ(kNoDatabase, ipc_database_id_);
478 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
479 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
481 scoped_ptr<IndexedDBMsg_CallbacksSuccessValue_Params> params(
482 new IndexedDBMsg_CallbacksSuccessValue_Params());
483 params->ipc_thread_id = ipc_thread_id_;
484 params->ipc_callbacks_id = ipc_callbacks_id_;
485 if (value && value->primary_key.IsValid()) {
486 params->value.primary_key = value->primary_key;
487 params->value.key_path = value->key_path;
489 if (value && !value->empty())
490 std::swap(params->value.bits, value->bits);
491 if (!value || value->blob_info.empty()) {
492 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessValue(*params));
493 } else {
494 IndexedDBMsg_CallbacksSuccessValue_Params* p = params.get();
495 FillInBlobData(value->blob_info, &p->value.blob_or_file_info);
496 RegisterBlobsAndSend(
497 value->blob_info,
498 base::Bind(CreateBlobsAndSend<IndexedDBMsg_CallbacksSuccessValue_Params,
499 IndexedDBMsg_CallbacksSuccessValue>,
500 base::Owned(params.release()), dispatcher_host_,
501 value->blob_info,
502 base::Unretained(&p->value.blob_or_file_info)));
504 dispatcher_host_ = NULL;
507 void IndexedDBCallbacks::OnSuccess(const IndexedDBKey& value) {
508 DCHECK(dispatcher_host_.get());
510 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
511 DCHECK_EQ(kNoTransaction, host_transaction_id_);
512 DCHECK_EQ(kNoDatabase, ipc_database_id_);
513 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
514 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
516 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessIndexedDBKey(
517 ipc_thread_id_, ipc_callbacks_id_, value));
518 dispatcher_host_ = NULL;
521 void IndexedDBCallbacks::OnSuccess(int64 value) {
522 DCHECK(dispatcher_host_.get());
524 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
525 DCHECK_EQ(kNoTransaction, host_transaction_id_);
526 DCHECK_EQ(kNoDatabase, ipc_database_id_);
527 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
528 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
530 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessInteger(
531 ipc_thread_id_, ipc_callbacks_id_, value));
532 dispatcher_host_ = NULL;
535 void IndexedDBCallbacks::OnSuccess() {
536 DCHECK(dispatcher_host_.get());
538 DCHECK_EQ(kNoCursor, ipc_cursor_id_);
539 DCHECK_EQ(kNoTransaction, host_transaction_id_);
540 DCHECK_EQ(kNoDatabase, ipc_database_id_);
541 DCHECK_EQ(kNoDatabaseCallbacks, ipc_database_callbacks_id_);
542 DCHECK_EQ(blink::WebIDBDataLossNone, data_loss_);
544 dispatcher_host_->Send(new IndexedDBMsg_CallbacksSuccessUndefined(
545 ipc_thread_id_, ipc_callbacks_id_));
546 dispatcher_host_ = NULL;
549 void IndexedDBCallbacks::SetConnectionOpenStartTime(
550 const base::TimeTicks& start_time) {
551 connection_open_start_time_ = start_time;
554 } // namespace content