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

Unified Diff: storage/browser/blob/blob_impl.cc

Issue 2892953006: WIP POC blob transport over mojo
Patch Set: pass mojo blobs over ipc Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/browser/blob/blob_impl.h ('k') | storage/browser/blob/blob_registry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/blob/blob_impl.cc
diff --git a/storage/browser/blob/blob_impl.cc b/storage/browser/blob/blob_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9013346f1c8acdf1aef6de8d0cdc0cdfe5a63afd
--- /dev/null
+++ b/storage/browser/blob/blob_impl.cc
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "storage/browser/blob/blob_impl.h"
+
+#include "storage/browser/blob/blob_data_handle.h"
+
+namespace storage {
+
+BlobImpl::BlobImpl(std::unique_ptr<BlobDataHandle> handle,
+ mojom::BlobRequest request)
+ : handle_(std::move(handle)) {
+ DCHECK(handle_);
+ bindings_.AddBinding(this, std::move(request));
+ bindings_.set_connection_error_handler(
+ base::Bind(&BlobImpl::OnConnectionError, base::Unretained(this)));
+}
+
+void BlobImpl::Clone(mojom::BlobRequest request) {
+ LOG(INFO) << "Cloning " << handle_->uuid();
+ bindings_.AddBinding(this, std::move(request));
+}
+
+void BlobImpl::InternalGetUUID(InternalGetUUIDCallback callback) {
+ LOG(INFO) << "Get UUID from " << handle_->uuid();
+ std::move(callback).Run(handle_->uuid());
+}
+
+BlobImpl::~BlobImpl() {}
+
+void BlobImpl::OnConnectionError() {
+ if (!bindings_.empty())
+ return;
+ LOG(INFO) << "Deleting " << handle_->uuid();
+ delete this;
+}
+
+} // namespace storage
« no previous file with comments | « storage/browser/blob/blob_impl.h ('k') | storage/browser/blob/blob_registry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698