| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "storage/browser/blob/blob_data_handle.h" | 5 #include "storage/browser/blob/blob_data_handle.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 base::SequencedTaskRunner* io_task_runner) | 96 base::SequencedTaskRunner* io_task_runner) |
| 97 : io_task_runner_(io_task_runner), | 97 : io_task_runner_(io_task_runner), |
| 98 shared_(new BlobDataHandleShared(uuid, | 98 shared_(new BlobDataHandleShared(uuid, |
| 99 content_type, | 99 content_type, |
| 100 content_disposition, | 100 content_disposition, |
| 101 context)) { | 101 context)) { |
| 102 DCHECK(io_task_runner_.get()); | 102 DCHECK(io_task_runner_.get()); |
| 103 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 103 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 BlobDataHandle::BlobDataHandle(const BlobDataHandle& other) { | 106 BlobDataHandle::BlobDataHandle(const BlobDataHandle& other) = default; |
| 107 io_task_runner_ = other.io_task_runner_; | |
| 108 shared_ = other.shared_; | |
| 109 } | |
| 110 | 107 |
| 111 BlobDataHandle::~BlobDataHandle() { | 108 BlobDataHandle::~BlobDataHandle() { |
| 112 if (!io_task_runner_->RunsTasksOnCurrentThread()) { | 109 if (!io_task_runner_->RunsTasksOnCurrentThread()) { |
| 113 BlobDataHandleShared* raw = shared_.get(); | 110 BlobDataHandleShared* raw = shared_.get(); |
| 114 raw->AddRef(); | 111 raw->AddRef(); |
| 115 shared_ = nullptr; | 112 shared_ = nullptr; |
| 116 io_task_runner_->ReleaseSoon(FROM_HERE, raw); | 113 io_task_runner_->ReleaseSoon(FROM_HERE, raw); |
| 117 } | 114 } |
| 118 } | 115 } |
| 119 | 116 |
| 117 BlobDataHandle& BlobDataHandle::operator=( |
| 118 const BlobDataHandle& other) = default; |
| 119 |
| 120 bool BlobDataHandle::IsBeingBuilt() const { | 120 bool BlobDataHandle::IsBeingBuilt() const { |
| 121 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 121 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); |
| 122 if (!shared_->context_) | 122 if (!shared_->context_) |
| 123 return false; | 123 return false; |
| 124 return shared_->context_->IsBeingBuilt(shared_->uuid_); | 124 return shared_->context_->IsBeingBuilt(shared_->uuid_); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool BlobDataHandle::IsBroken() const { | 127 bool BlobDataHandle::IsBroken() const { |
| 128 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); | 128 DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); |
| 129 if (!shared_->context_) | 129 if (!shared_->context_) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 const std::string& BlobDataHandle::content_type() const { | 155 const std::string& BlobDataHandle::content_type() const { |
| 156 return shared_->content_type_; | 156 return shared_->content_type_; |
| 157 } | 157 } |
| 158 | 158 |
| 159 const std::string& BlobDataHandle::content_disposition() const { | 159 const std::string& BlobDataHandle::content_disposition() const { |
| 160 return shared_->content_disposition_; | 160 return shared_->content_disposition_; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace storage | 163 } // namespace storage |
| OLD | NEW |