| OLD | NEW |
| 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/blob_storage/webblobregistry_impl.h" | 5 #include "content/child/blob_storage/webblobregistry_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/numerics/safe_conversions.h" | 16 #include "base/numerics/safe_conversions.h" |
| 16 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 17 #include "content/child/blob_storage/blob_consolidation.h" | 18 #include "content/child/blob_storage/blob_consolidation.h" |
| 18 #include "content/child/blob_storage/blob_transport_controller.h" | 19 #include "content/child/blob_storage/blob_transport_controller.h" |
| 19 #include "content/child/child_thread_impl.h" | 20 #include "content/child/child_thread_impl.h" |
| 20 #include "content/child/thread_safe_sender.h" | 21 #include "content/child/thread_safe_sender.h" |
| 21 #include "content/common/fileapi/webblob_messages.h" | 22 #include "content/common/fileapi/webblob_messages.h" |
| 22 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 23 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
| 23 #include "third_party/WebKit/public/platform/WebBlobData.h" | 24 #include "third_party/WebKit/public/platform/WebBlobData.h" |
| 24 #include "third_party/WebKit/public/platform/WebString.h" | 25 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void WebBlobRegistryImpl::addBlobDataRef(const WebString& uuid) { | 105 void WebBlobRegistryImpl::addBlobDataRef(const WebString& uuid) { |
| 105 sender_->Send(new BlobHostMsg_IncrementRefCount(uuid.utf8())); | 106 sender_->Send(new BlobHostMsg_IncrementRefCount(uuid.utf8())); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void WebBlobRegistryImpl::removeBlobDataRef(const WebString& uuid) { | 109 void WebBlobRegistryImpl::removeBlobDataRef(const WebString& uuid) { |
| 109 sender_->Send(new BlobHostMsg_DecrementRefCount(uuid.utf8())); | 110 sender_->Send(new BlobHostMsg_DecrementRefCount(uuid.utf8())); |
| 110 } | 111 } |
| 111 | 112 |
| 112 void WebBlobRegistryImpl::registerPublicBlobURL(const WebURL& url, | 113 void WebBlobRegistryImpl::registerPublicBlobURL(const WebURL& url, |
| 113 const WebString& uuid) { | 114 const WebString& uuid) { |
| 115 // Measure how much jank the following synchronous IPC introduces. |
| 116 SCOPED_UMA_HISTOGRAM_TIMER("Storage.Blob.RegisterPublicURLTime"); |
| 117 |
| 114 sender_->Send(new BlobHostMsg_RegisterPublicURL(url, uuid.utf8())); | 118 sender_->Send(new BlobHostMsg_RegisterPublicURL(url, uuid.utf8())); |
| 115 } | 119 } |
| 116 | 120 |
| 117 void WebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) { | 121 void WebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) { |
| 118 sender_->Send(new BlobHostMsg_RevokePublicURL(url)); | 122 sender_->Send(new BlobHostMsg_RevokePublicURL(url)); |
| 119 } | 123 } |
| 120 | 124 |
| 121 // ------ streams stuff ----- | 125 // ------ streams stuff ----- |
| 122 | 126 |
| 123 void WebBlobRegistryImpl::registerStreamURL(const WebURL& url, | 127 void WebBlobRegistryImpl::registerStreamURL(const WebURL& url, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 expected_modification_time); | 237 expected_modification_time); |
| 234 } | 238 } |
| 235 | 239 |
| 236 void WebBlobRegistryImpl::BuilderImpl::build() { | 240 void WebBlobRegistryImpl::BuilderImpl::build() { |
| 237 BlobTransportController::InitiateBlobTransfer( | 241 BlobTransportController::InitiateBlobTransfer( |
| 238 uuid_, content_type_, std::move(consolidation_), sender_, | 242 uuid_, content_type_, std::move(consolidation_), sender_, |
| 239 io_runner_.get(), main_runner_); | 243 io_runner_.get(), main_runner_); |
| 240 } | 244 } |
| 241 | 245 |
| 242 } // namespace content | 246 } // namespace content |
| OLD | NEW |