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

Side by Side Diff: content/child/indexed_db/webidbdatabase_impl.cc

Issue 2500263003: Port messages sent by WebIDBCursorImpl to Mojo. (Closed)
Patch Set: Address dcheng@'s comments. 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/child/indexed_db/webidbdatabase_impl.h" 5 #include "content/child/indexed_db/webidbdatabase_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "content/child/indexed_db/indexed_db_callbacks_impl.h" 13 #include "content/child/indexed_db/indexed_db_callbacks_impl.h"
14 #include "content/child/indexed_db/indexed_db_dispatcher.h" 14 #include "content/child/indexed_db/indexed_db_dispatcher.h"
15 #include "content/child/indexed_db/indexed_db_key_builders.h" 15 #include "content/child/indexed_db/indexed_db_key_builders.h"
16 #include "content/child/thread_safe_sender.h"
17 #include "content/child/worker_thread_registry.h" 16 #include "content/child/worker_thread_registry.h"
18 #include "content/common/indexed_db/indexed_db_messages.h" 17 #include "content/common/indexed_db/indexed_db_messages.h"
19 #include "mojo/public/cpp/bindings/strong_associated_binding.h" 18 #include "mojo/public/cpp/bindings/strong_associated_binding.h"
20 #include "third_party/WebKit/public/platform/WebBlobInfo.h" 19 #include "third_party/WebKit/public/platform/WebBlobInfo.h"
21 #include "third_party/WebKit/public/platform/WebString.h" 20 #include "third_party/WebKit/public/platform/WebString.h"
22 #include "third_party/WebKit/public/platform/WebVector.h" 21 #include "third_party/WebKit/public/platform/WebVector.h"
23 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseErr or.h" 22 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseErr or.h"
24 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc eption.h" 23 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc eption.h"
25 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h" 24 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h"
26 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h" 25 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 CallbacksAssociatedPtrInfo GetCallbacksProxy( 156 CallbacksAssociatedPtrInfo GetCallbacksProxy(
158 std::unique_ptr<IndexedDBCallbacksImpl> callbacks); 157 std::unique_ptr<IndexedDBCallbacksImpl> callbacks);
159 158
160 indexed_db::mojom::DatabaseAssociatedPtr database_; 159 indexed_db::mojom::DatabaseAssociatedPtr database_;
161 160
162 DISALLOW_COPY_AND_ASSIGN(IOThreadHelper); 161 DISALLOW_COPY_AND_ASSIGN(IOThreadHelper);
163 }; 162 };
164 163
165 WebIDBDatabaseImpl::WebIDBDatabaseImpl( 164 WebIDBDatabaseImpl::WebIDBDatabaseImpl(
166 DatabaseAssociatedPtrInfo database_info, 165 DatabaseAssociatedPtrInfo database_info,
167 scoped_refptr<base::SingleThreadTaskRunner> io_runner, 166 scoped_refptr<base::SingleThreadTaskRunner> io_runner)
168 scoped_refptr<ThreadSafeSender> thread_safe_sender) 167 : helper_(new IOThreadHelper()), io_runner_(std::move(io_runner)) {
169 : helper_(new IOThreadHelper()),
170 io_runner_(std::move(io_runner)),
171 thread_safe_sender_(std::move(thread_safe_sender)) {
172 io_runner_->PostTask( 168 io_runner_->PostTask(
173 FROM_HERE, base::Bind(&IOThreadHelper::Bind, base::Unretained(helper_), 169 FROM_HERE, base::Bind(&IOThreadHelper::Bind, base::Unretained(helper_),
174 base::Passed(&database_info))); 170 base::Passed(&database_info)));
175 } 171 }
176 172
177 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() { 173 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() {
178 io_runner_->DeleteSoon(FROM_HERE, helper_); 174 io_runner_->DeleteSoon(FROM_HERE, helper_);
179 } 175 }
180 176
181 void WebIDBDatabaseImpl::createObjectStore(long long transaction_id, 177 void WebIDBDatabaseImpl::createObjectStore(long long transaction_id,
(...skipping 30 matching lines...) Expand all
212 blink::WebIDBTransactionMode mode) { 208 blink::WebIDBTransactionMode mode) {
213 io_runner_->PostTask( 209 io_runner_->PostTask(
214 FROM_HERE, 210 FROM_HERE,
215 base::Bind(&IOThreadHelper::CreateTransaction, base::Unretained(helper_), 211 base::Bind(&IOThreadHelper::CreateTransaction, base::Unretained(helper_),
216 transaction_id, std::vector<int64_t>(object_store_ids.begin(), 212 transaction_id, std::vector<int64_t>(object_store_ids.begin(),
217 object_store_ids.end()), 213 object_store_ids.end()),
218 mode)); 214 mode));
219 } 215 }
220 216
221 void WebIDBDatabaseImpl::close() { 217 void WebIDBDatabaseImpl::close() {
222 IndexedDBDispatcher* dispatcher =
223 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
224 std::vector<int32_t> remove_observer_ids(observer_ids_.begin(), 218 std::vector<int32_t> remove_observer_ids(observer_ids_.begin(),
225 observer_ids_.end()); 219 observer_ids_.end());
226 dispatcher->RemoveObservers(remove_observer_ids); 220 IndexedDBDispatcher::ThreadSpecificInstance()->RemoveObservers(
221 remove_observer_ids);
227 io_runner_->PostTask( 222 io_runner_->PostTask(
228 FROM_HERE, base::Bind(&IOThreadHelper::Close, base::Unretained(helper_))); 223 FROM_HERE, base::Bind(&IOThreadHelper::Close, base::Unretained(helper_)));
229 } 224 }
230 225
231 void WebIDBDatabaseImpl::versionChangeIgnored() { 226 void WebIDBDatabaseImpl::versionChangeIgnored() {
232 io_runner_->PostTask(FROM_HERE, 227 io_runner_->PostTask(FROM_HERE,
233 base::Bind(&IOThreadHelper::VersionChangeIgnored, 228 base::Bind(&IOThreadHelper::VersionChangeIgnored,
234 base::Unretained(helper_))); 229 base::Unretained(helper_)));
235 } 230 }
236 231
237 int32_t WebIDBDatabaseImpl::addObserver( 232 int32_t WebIDBDatabaseImpl::addObserver(
238 std::unique_ptr<WebIDBObserver> observer, 233 std::unique_ptr<WebIDBObserver> observer,
239 long long transaction_id) { 234 long long transaction_id) {
240 IndexedDBDispatcher* dispatcher =
241 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
242 WebIDBObserver* observer_ptr = observer.get(); 235 WebIDBObserver* observer_ptr = observer.get();
243 int32_t observer_id = dispatcher->RegisterObserver(std::move(observer)); 236 int32_t observer_id =
237 IndexedDBDispatcher::ThreadSpecificInstance()->RegisterObserver(
238 std::move(observer));
244 observer_ids_.insert(observer_id); 239 observer_ids_.insert(observer_id);
245 static_assert(blink::WebIDBOperationTypeCount < sizeof(uint16_t) * CHAR_BIT, 240 static_assert(blink::WebIDBOperationTypeCount < sizeof(uint16_t) * CHAR_BIT,
246 "WebIDBOperationType Count exceeds size of uint16_t"); 241 "WebIDBOperationType Count exceeds size of uint16_t");
247 io_runner_->PostTask( 242 io_runner_->PostTask(
248 FROM_HERE, 243 FROM_HERE,
249 base::Bind(&IOThreadHelper::AddObserver, base::Unretained(helper_), 244 base::Bind(&IOThreadHelper::AddObserver, base::Unretained(helper_),
250 transaction_id, observer_id, observer_ptr->transaction(), 245 transaction_id, observer_id, observer_ptr->transaction(),
251 observer_ptr->noRecords(), observer_ptr->values(), 246 observer_ptr->noRecords(), observer_ptr->values(),
252 observer_ptr->operationTypes().to_ulong())); 247 observer_ptr->operationTypes().to_ulong()));
253 return observer_id; 248 return observer_id;
254 } 249 }
255 250
256 void WebIDBDatabaseImpl::removeObservers( 251 void WebIDBDatabaseImpl::removeObservers(
257 const WebVector<int32_t>& observer_ids_to_remove) { 252 const WebVector<int32_t>& observer_ids_to_remove) {
258 std::vector<int32_t> remove_observer_ids( 253 std::vector<int32_t> remove_observer_ids(
259 observer_ids_to_remove.data(), 254 observer_ids_to_remove.data(),
260 observer_ids_to_remove.data() + observer_ids_to_remove.size()); 255 observer_ids_to_remove.data() + observer_ids_to_remove.size());
261 for (int32_t id : observer_ids_to_remove) 256 for (int32_t id : observer_ids_to_remove)
262 observer_ids_.erase(id); 257 observer_ids_.erase(id);
263 258
264 IndexedDBDispatcher* dispatcher = 259 IndexedDBDispatcher::ThreadSpecificInstance()->RemoveObservers(
265 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 260 remove_observer_ids);
266 dispatcher->RemoveObservers(remove_observer_ids);
267 io_runner_->PostTask( 261 io_runner_->PostTask(
268 FROM_HERE, base::Bind(&IOThreadHelper::RemoveObservers, 262 FROM_HERE, base::Bind(&IOThreadHelper::RemoveObservers,
269 base::Unretained(helper_), remove_observer_ids)); 263 base::Unretained(helper_), remove_observer_ids));
270 } 264 }
271 265
272 void WebIDBDatabaseImpl::get(long long transaction_id, 266 void WebIDBDatabaseImpl::get(long long transaction_id,
273 long long object_store_id, 267 long long object_store_id,
274 long long index_id, 268 long long index_id,
275 const WebIDBKeyRange& key_range, 269 const WebIDBKeyRange& key_range,
276 bool key_only, 270 bool key_only,
277 WebIDBCallbacks* callbacks) { 271 WebIDBCallbacks* callbacks) {
278 IndexedDBDispatcher* dispatcher = 272 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
279 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 273 transaction_id, nullptr);
280 dispatcher->ResetCursorPrefetchCaches(transaction_id,
281 IndexedDBDispatcher::kAllCursors);
282 274
283 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 275 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
284 base::WrapUnique(callbacks), transaction_id, io_runner_, 276 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
285 thread_safe_sender_);
286 io_runner_->PostTask( 277 io_runner_->PostTask(
287 FROM_HERE, base::Bind(&IOThreadHelper::Get, base::Unretained(helper_), 278 FROM_HERE, base::Bind(&IOThreadHelper::Get, base::Unretained(helper_),
288 transaction_id, object_store_id, index_id, 279 transaction_id, object_store_id, index_id,
289 IndexedDBKeyRangeBuilder::Build(key_range), 280 IndexedDBKeyRangeBuilder::Build(key_range),
290 key_only, base::Passed(&callbacks_impl))); 281 key_only, base::Passed(&callbacks_impl)));
291 } 282 }
292 283
293 void WebIDBDatabaseImpl::getAll(long long transaction_id, 284 void WebIDBDatabaseImpl::getAll(long long transaction_id,
294 long long object_store_id, 285 long long object_store_id,
295 long long index_id, 286 long long index_id,
296 const WebIDBKeyRange& key_range, 287 const WebIDBKeyRange& key_range,
297 long long max_count, 288 long long max_count,
298 bool key_only, 289 bool key_only,
299 WebIDBCallbacks* callbacks) { 290 WebIDBCallbacks* callbacks) {
300 IndexedDBDispatcher* dispatcher = 291 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
301 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 292 transaction_id, nullptr);
302 dispatcher->ResetCursorPrefetchCaches(transaction_id,
303 IndexedDBDispatcher::kAllCursors);
304 293
305 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 294 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
306 base::WrapUnique(callbacks), transaction_id, io_runner_, 295 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
307 thread_safe_sender_);
308 io_runner_->PostTask( 296 io_runner_->PostTask(
309 FROM_HERE, 297 FROM_HERE,
310 base::Bind(&IOThreadHelper::GetAll, base::Unretained(helper_), 298 base::Bind(&IOThreadHelper::GetAll, base::Unretained(helper_),
311 transaction_id, object_store_id, index_id, 299 transaction_id, object_store_id, index_id,
312 IndexedDBKeyRangeBuilder::Build(key_range), max_count, 300 IndexedDBKeyRangeBuilder::Build(key_range), max_count,
313 key_only, base::Passed(&callbacks_impl))); 301 key_only, base::Passed(&callbacks_impl)));
314 } 302 }
315 303
316 void WebIDBDatabaseImpl::put(long long transaction_id, 304 void WebIDBDatabaseImpl::put(long long transaction_id,
317 long long object_store_id, 305 long long object_store_id,
318 const blink::WebData& value, 306 const blink::WebData& value,
319 const blink::WebVector<WebBlobInfo>& web_blob_info, 307 const blink::WebVector<WebBlobInfo>& web_blob_info,
320 const WebIDBKey& web_key, 308 const WebIDBKey& web_key,
321 blink::WebIDBPutMode put_mode, 309 blink::WebIDBPutMode put_mode,
322 WebIDBCallbacks* callbacks, 310 WebIDBCallbacks* callbacks,
323 const WebVector<long long>& index_ids, 311 const WebVector<long long>& index_ids,
324 const WebVector<WebIndexKeys>& index_keys) { 312 const WebVector<WebIndexKeys>& index_keys) {
325 IndexedDBKey key = IndexedDBKeyBuilder::Build(web_key); 313 IndexedDBKey key = IndexedDBKeyBuilder::Build(web_key);
326 314
327 if (value.size() + key.size_estimate() > max_put_value_size_) { 315 if (value.size() + key.size_estimate() > max_put_value_size_) {
328 callbacks->onError(blink::WebIDBDatabaseError( 316 callbacks->onError(blink::WebIDBDatabaseError(
329 blink::WebIDBDatabaseExceptionUnknownError, 317 blink::WebIDBDatabaseExceptionUnknownError,
330 WebString::fromUTF8(base::StringPrintf( 318 WebString::fromUTF8(base::StringPrintf(
331 "The serialized value is too large" 319 "The serialized value is too large"
332 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).", 320 " (size=%" PRIuS " bytes, max=%" PRIuS " bytes).",
333 value.size(), max_put_value_size_)))); 321 value.size(), max_put_value_size_))));
334 return; 322 return;
335 } 323 }
336 324
337 IndexedDBDispatcher* dispatcher = 325 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
338 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 326 transaction_id, nullptr);
339 dispatcher->ResetCursorPrefetchCaches(transaction_id,
340 IndexedDBDispatcher::kAllCursors);
341 327
342 auto mojo_value = indexed_db::mojom::Value::New(); 328 auto mojo_value = indexed_db::mojom::Value::New();
343 mojo_value->bits.assign(value.data(), value.data() + value.size()); 329 mojo_value->bits.assign(value.data(), value.data() + value.size());
344 mojo_value->blob_or_file_info.reserve(web_blob_info.size()); 330 mojo_value->blob_or_file_info.reserve(web_blob_info.size());
345 for (const WebBlobInfo& info : web_blob_info) { 331 for (const WebBlobInfo& info : web_blob_info) {
346 auto blob_info = indexed_db::mojom::BlobInfo::New(); 332 auto blob_info = indexed_db::mojom::BlobInfo::New();
347 if (info.isFile()) { 333 if (info.isFile()) {
348 blob_info->file = indexed_db::mojom::FileInfo::New(); 334 blob_info->file = indexed_db::mojom::FileInfo::New();
349 blob_info->file->path = 335 blob_info->file->path =
350 base::FilePath::FromUTF8Unsafe(info.filePath().utf8()); 336 base::FilePath::FromUTF8Unsafe(info.filePath().utf8());
351 blob_info->file->name = info.fileName(); 337 blob_info->file->name = info.fileName();
352 blob_info->file->last_modified = 338 blob_info->file->last_modified =
353 base::Time::FromDoubleT(info.lastModified()); 339 base::Time::FromDoubleT(info.lastModified());
354 } 340 }
355 blob_info->size = info.size(); 341 blob_info->size = info.size();
356 blob_info->uuid = info.uuid().latin1(); 342 blob_info->uuid = info.uuid().latin1();
357 DCHECK(blob_info->uuid.size()); 343 DCHECK(blob_info->uuid.size());
358 blob_info->mime_type = info.type(); 344 blob_info->mime_type = info.type();
359 mojo_value->blob_or_file_info.push_back(std::move(blob_info)); 345 mojo_value->blob_or_file_info.push_back(std::move(blob_info));
360 } 346 }
361 347
362 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 348 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
363 base::WrapUnique(callbacks), transaction_id, io_runner_, 349 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
364 thread_safe_sender_);
365 io_runner_->PostTask( 350 io_runner_->PostTask(
366 FROM_HERE, 351 FROM_HERE,
367 base::Bind(&IOThreadHelper::Put, base::Unretained(helper_), 352 base::Bind(&IOThreadHelper::Put, base::Unretained(helper_),
368 transaction_id, object_store_id, base::Passed(&mojo_value), 353 transaction_id, object_store_id, base::Passed(&mojo_value),
369 key, put_mode, base::Passed(&callbacks_impl), 354 key, put_mode, base::Passed(&callbacks_impl),
370 ConvertWebIndexKeys(index_ids, index_keys))); 355 ConvertWebIndexKeys(index_ids, index_keys)));
371 } 356 }
372 357
373 void WebIDBDatabaseImpl::setIndexKeys( 358 void WebIDBDatabaseImpl::setIndexKeys(
374 long long transaction_id, 359 long long transaction_id,
(...skipping 22 matching lines...) Expand all
397 } 382 }
398 383
399 void WebIDBDatabaseImpl::openCursor(long long transaction_id, 384 void WebIDBDatabaseImpl::openCursor(long long transaction_id,
400 long long object_store_id, 385 long long object_store_id,
401 long long index_id, 386 long long index_id,
402 const WebIDBKeyRange& key_range, 387 const WebIDBKeyRange& key_range,
403 blink::WebIDBCursorDirection direction, 388 blink::WebIDBCursorDirection direction,
404 bool key_only, 389 bool key_only,
405 blink::WebIDBTaskType task_type, 390 blink::WebIDBTaskType task_type,
406 WebIDBCallbacks* callbacks) { 391 WebIDBCallbacks* callbacks) {
407 IndexedDBDispatcher* dispatcher = 392 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
408 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 393 transaction_id, nullptr);
409 dispatcher->ResetCursorPrefetchCaches(transaction_id,
410 IndexedDBDispatcher::kAllCursors);
411 394
412 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 395 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
413 base::WrapUnique(callbacks), transaction_id, io_runner_, 396 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
414 thread_safe_sender_);
415 io_runner_->PostTask( 397 io_runner_->PostTask(
416 FROM_HERE, 398 FROM_HERE,
417 base::Bind(&IOThreadHelper::OpenCursor, base::Unretained(helper_), 399 base::Bind(&IOThreadHelper::OpenCursor, base::Unretained(helper_),
418 transaction_id, object_store_id, index_id, 400 transaction_id, object_store_id, index_id,
419 IndexedDBKeyRangeBuilder::Build(key_range), direction, 401 IndexedDBKeyRangeBuilder::Build(key_range), direction,
420 key_only, task_type, base::Passed(&callbacks_impl))); 402 key_only, task_type, base::Passed(&callbacks_impl)));
421 } 403 }
422 404
423 void WebIDBDatabaseImpl::count(long long transaction_id, 405 void WebIDBDatabaseImpl::count(long long transaction_id,
424 long long object_store_id, 406 long long object_store_id,
425 long long index_id, 407 long long index_id,
426 const WebIDBKeyRange& key_range, 408 const WebIDBKeyRange& key_range,
427 WebIDBCallbacks* callbacks) { 409 WebIDBCallbacks* callbacks) {
428 IndexedDBDispatcher* dispatcher = 410 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
429 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 411 transaction_id, nullptr);
430 dispatcher->ResetCursorPrefetchCaches(transaction_id,
431 IndexedDBDispatcher::kAllCursors);
432 412
433 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 413 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
434 base::WrapUnique(callbacks), transaction_id, io_runner_, 414 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
435 thread_safe_sender_);
436 io_runner_->PostTask( 415 io_runner_->PostTask(
437 FROM_HERE, base::Bind(&IOThreadHelper::Count, base::Unretained(helper_), 416 FROM_HERE, base::Bind(&IOThreadHelper::Count, base::Unretained(helper_),
438 transaction_id, object_store_id, index_id, 417 transaction_id, object_store_id, index_id,
439 IndexedDBKeyRangeBuilder::Build(key_range), 418 IndexedDBKeyRangeBuilder::Build(key_range),
440 base::Passed(&callbacks_impl))); 419 base::Passed(&callbacks_impl)));
441 } 420 }
442 421
443 void WebIDBDatabaseImpl::deleteRange(long long transaction_id, 422 void WebIDBDatabaseImpl::deleteRange(long long transaction_id,
444 long long object_store_id, 423 long long object_store_id,
445 const WebIDBKeyRange& key_range, 424 const WebIDBKeyRange& key_range,
446 WebIDBCallbacks* callbacks) { 425 WebIDBCallbacks* callbacks) {
447 IndexedDBDispatcher* dispatcher = 426 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
448 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 427 transaction_id, nullptr);
449 dispatcher->ResetCursorPrefetchCaches(transaction_id,
450 IndexedDBDispatcher::kAllCursors);
451 428
452 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 429 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
453 base::WrapUnique(callbacks), transaction_id, io_runner_, 430 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
454 thread_safe_sender_);
455 io_runner_->PostTask( 431 io_runner_->PostTask(
456 FROM_HERE, 432 FROM_HERE,
457 base::Bind(&IOThreadHelper::DeleteRange, base::Unretained(helper_), 433 base::Bind(&IOThreadHelper::DeleteRange, base::Unretained(helper_),
458 transaction_id, object_store_id, 434 transaction_id, object_store_id,
459 IndexedDBKeyRangeBuilder::Build(key_range), 435 IndexedDBKeyRangeBuilder::Build(key_range),
460 base::Passed(&callbacks_impl))); 436 base::Passed(&callbacks_impl)));
461 } 437 }
462 438
463 void WebIDBDatabaseImpl::clear(long long transaction_id, 439 void WebIDBDatabaseImpl::clear(long long transaction_id,
464 long long object_store_id, 440 long long object_store_id,
465 WebIDBCallbacks* callbacks) { 441 WebIDBCallbacks* callbacks) {
466 IndexedDBDispatcher* dispatcher = 442 IndexedDBDispatcher::ThreadSpecificInstance()->ResetCursorPrefetchCaches(
467 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 443 transaction_id, nullptr);
468 dispatcher->ResetCursorPrefetchCaches(transaction_id,
469 IndexedDBDispatcher::kAllCursors);
470 444
471 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>( 445 auto callbacks_impl = base::MakeUnique<IndexedDBCallbacksImpl>(
472 base::WrapUnique(callbacks), transaction_id, io_runner_, 446 base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_);
473 thread_safe_sender_);
474 io_runner_->PostTask( 447 io_runner_->PostTask(
475 FROM_HERE, base::Bind(&IOThreadHelper::Clear, base::Unretained(helper_), 448 FROM_HERE, base::Bind(&IOThreadHelper::Clear, base::Unretained(helper_),
476 transaction_id, object_store_id, 449 transaction_id, object_store_id,
477 base::Passed(&callbacks_impl))); 450 base::Passed(&callbacks_impl)));
478 } 451 }
479 452
480 void WebIDBDatabaseImpl::createIndex(long long transaction_id, 453 void WebIDBDatabaseImpl::createIndex(long long transaction_id,
481 long long object_store_id, 454 long long object_store_id,
482 long long index_id, 455 long long index_id,
483 const WebString& name, 456 const WebString& name,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) { 705 std::unique_ptr<IndexedDBCallbacksImpl> callbacks) {
733 CallbacksAssociatedPtrInfo ptr_info; 706 CallbacksAssociatedPtrInfo ptr_info;
734 indexed_db::mojom::CallbacksAssociatedRequest request; 707 indexed_db::mojom::CallbacksAssociatedRequest request;
735 database_.associated_group()->CreateAssociatedInterface( 708 database_.associated_group()->CreateAssociatedInterface(
736 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request); 709 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
737 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request)); 710 mojo::MakeStrongAssociatedBinding(std::move(callbacks), std::move(request));
738 return ptr_info; 711 return ptr_info;
739 } 712 }
740 713
741 } // namespace content 714 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/webidbdatabase_impl.h ('k') | content/child/indexed_db/webidbdatabase_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698