| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #include "storage/browser/blob/blob_impl.h" |
| 6 |
| 7 #include "storage/browser/blob/blob_data_handle.h" |
| 8 |
| 9 namespace storage { |
| 10 |
| 11 BlobImpl::BlobImpl(std::unique_ptr<BlobDataHandle> handle, |
| 12 mojom::BlobRequest request) |
| 13 : handle_(std::move(handle)) { |
| 14 DCHECK(handle_); |
| 15 bindings_.AddBinding(this, std::move(request)); |
| 16 bindings_.set_connection_error_handler( |
| 17 base::Bind(&BlobImpl::OnConnectionError, base::Unretained(this))); |
| 18 } |
| 19 |
| 20 void BlobImpl::Clone(mojom::BlobRequest request) { |
| 21 LOG(INFO) << "Cloning " << handle_->uuid(); |
| 22 bindings_.AddBinding(this, std::move(request)); |
| 23 } |
| 24 |
| 25 void BlobImpl::InternalGetUUID(InternalGetUUIDCallback callback) { |
| 26 LOG(INFO) << "Get UUID from " << handle_->uuid(); |
| 27 std::move(callback).Run(handle_->uuid()); |
| 28 } |
| 29 |
| 30 BlobImpl::~BlobImpl() {} |
| 31 |
| 32 void BlobImpl::OnConnectionError() { |
| 33 if (!bindings_.empty()) |
| 34 return; |
| 35 LOG(INFO) << "Deleting " << handle_->uuid(); |
| 36 delete this; |
| 37 } |
| 38 |
| 39 } // namespace storage |
| OLD | NEW |