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

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

Issue 2695333002: Mojo C++ bindings: remove usage of AssociatedGroup from content/ (Closed)
Patch Set: . Created 3 years, 10 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
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/indexed_db/indexed_db_callbacks.h" 5 #include "content/browser/indexed_db/indexed_db_callbacks.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 void IndexedDBCallbacks::IOThreadHelper::SendUpgradeNeeded( 472 void IndexedDBCallbacks::IOThreadHelper::SendUpgradeNeeded(
473 std::unique_ptr<DatabaseImpl> database, 473 std::unique_ptr<DatabaseImpl> database,
474 int64_t old_version, 474 int64_t old_version,
475 blink::WebIDBDataLoss data_loss, 475 blink::WebIDBDataLoss data_loss,
476 const std::string& data_loss_message, 476 const std::string& data_loss_message,
477 const content::IndexedDBDatabaseMetadata& metadata) { 477 const content::IndexedDBDatabaseMetadata& metadata) {
478 if (!callbacks_) 478 if (!callbacks_)
479 return; 479 return;
480 480
481 ::indexed_db::mojom::DatabaseAssociatedPtrInfo ptr_info; 481 ::indexed_db::mojom::DatabaseAssociatedPtrInfo ptr_info;
482 ::indexed_db::mojom::DatabaseAssociatedRequest request; 482 auto request = mojo::MakeRequest(&ptr_info);
483 callbacks_.associated_group()->CreateAssociatedInterface(
484 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
485 mojo::MakeStrongAssociatedBinding(std::move(database), std::move(request)); 483 mojo::MakeStrongAssociatedBinding(std::move(database), std::move(request));
486 callbacks_->UpgradeNeeded(std::move(ptr_info), old_version, data_loss, 484 callbacks_->UpgradeNeeded(std::move(ptr_info), old_version, data_loss,
487 data_loss_message, metadata); 485 data_loss_message, metadata);
488 } 486 }
489 487
490 void IndexedDBCallbacks::IOThreadHelper::SendSuccessDatabase( 488 void IndexedDBCallbacks::IOThreadHelper::SendSuccessDatabase(
491 std::unique_ptr<DatabaseImpl> database, 489 std::unique_ptr<DatabaseImpl> database,
492 const content::IndexedDBDatabaseMetadata& metadata) { 490 const content::IndexedDBDatabaseMetadata& metadata) {
493 if (!callbacks_) 491 if (!callbacks_)
494 return; 492 return;
495 493
496 ::indexed_db::mojom::DatabaseAssociatedPtrInfo ptr_info; 494 ::indexed_db::mojom::DatabaseAssociatedPtrInfo ptr_info;
497 if (database) { 495 if (database) {
498 ::indexed_db::mojom::DatabaseAssociatedRequest request; 496 auto request = mojo::MakeRequest(&ptr_info);
499 callbacks_.associated_group()->CreateAssociatedInterface(
500 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
501 mojo::MakeStrongAssociatedBinding(std::move(database), std::move(request)); 497 mojo::MakeStrongAssociatedBinding(std::move(database), std::move(request));
502 } 498 }
503 callbacks_->SuccessDatabase(std::move(ptr_info), metadata); 499 callbacks_->SuccessDatabase(std::move(ptr_info), metadata);
504 } 500 }
505 501
506 void IndexedDBCallbacks::IOThreadHelper::SendSuccessCursor( 502 void IndexedDBCallbacks::IOThreadHelper::SendSuccessCursor(
507 std::unique_ptr<CursorImpl> cursor, 503 std::unique_ptr<CursorImpl> cursor,
508 const IndexedDBKey& key, 504 const IndexedDBKey& key,
509 const IndexedDBKey& primary_key, 505 const IndexedDBKey& primary_key,
510 ::indexed_db::mojom::ValuePtr value, 506 ::indexed_db::mojom::ValuePtr value,
511 const std::vector<IndexedDBBlobInfo>& blob_info) { 507 const std::vector<IndexedDBBlobInfo>& blob_info) {
512 if (!callbacks_) 508 if (!callbacks_)
513 return; 509 return;
514 510
515 if (value && !CreateAllBlobs(blob_info, &value->blob_or_file_info)) 511 if (value && !CreateAllBlobs(blob_info, &value->blob_or_file_info))
516 return; 512 return;
517 513
518 ::indexed_db::mojom::CursorAssociatedPtrInfo ptr_info; 514 ::indexed_db::mojom::CursorAssociatedPtrInfo ptr_info;
519 ::indexed_db::mojom::CursorAssociatedRequest request; 515 auto request = mojo::MakeRequest(&ptr_info);
520 callbacks_.associated_group()->CreateAssociatedInterface(
521 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
522 mojo::MakeStrongAssociatedBinding(std::move(cursor), std::move(request)); 516 mojo::MakeStrongAssociatedBinding(std::move(cursor), std::move(request));
523 callbacks_->SuccessCursor(std::move(ptr_info), key, primary_key, 517 callbacks_->SuccessCursor(std::move(ptr_info), key, primary_key,
524 std::move(value)); 518 std::move(value));
525 } 519 }
526 520
527 void IndexedDBCallbacks::IOThreadHelper::SendSuccessValue( 521 void IndexedDBCallbacks::IOThreadHelper::SendSuccessValue(
528 ::indexed_db::mojom::ReturnValuePtr value, 522 ::indexed_db::mojom::ReturnValuePtr value,
529 const std::vector<IndexedDBBlobInfo>& blob_info) { 523 const std::vector<IndexedDBBlobInfo>& blob_info) {
530 if (!callbacks_) 524 if (!callbacks_)
531 return; 525 return;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 (*blob_or_file_info)[i]->uuid = CreateBlobData(blob_info[i]); 622 (*blob_or_file_info)[i]->uuid = CreateBlobData(blob_info[i]);
629 return true; 623 return true;
630 } 624 }
631 625
632 void IndexedDBCallbacks::IOThreadHelper::OnConnectionError() { 626 void IndexedDBCallbacks::IOThreadHelper::OnConnectionError() {
633 callbacks_.reset(); 627 callbacks_.reset();
634 dispatcher_host_ = nullptr; 628 dispatcher_host_ = nullptr;
635 } 629 }
636 630
637 } // namespace content 631 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/leveldb_wrapper_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698