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 this synchronous IPC is introducing. |
| 116 base::TimeTicks time_before = base::TimeTicks::Now(); |
| 117 |
114 sender_->Send(new BlobHostMsg_RegisterPublicURL(url, uuid.utf8())); | 118 sender_->Send(new BlobHostMsg_RegisterPublicURL(url, uuid.utf8())); |
| 119 |
| 120 base::TimeDelta time_delta = base::TimeTicks::Now() - time_before; |
| 121 UMA_HISTOGRAM_TIMES("Storage.Blob.RegisterPublicURLTime", time_delta); |
115 } | 122 } |
116 | 123 |
117 void WebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) { | 124 void WebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) { |
118 sender_->Send(new BlobHostMsg_RevokePublicURL(url)); | 125 sender_->Send(new BlobHostMsg_RevokePublicURL(url)); |
119 } | 126 } |
120 | 127 |
121 // ------ streams stuff ----- | 128 // ------ streams stuff ----- |
122 | 129 |
123 void WebBlobRegistryImpl::registerStreamURL(const WebURL& url, | 130 void WebBlobRegistryImpl::registerStreamURL(const WebURL& url, |
124 const WebString& content_type) { | 131 const WebString& content_type) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 expected_modification_time); | 240 expected_modification_time); |
234 } | 241 } |
235 | 242 |
236 void WebBlobRegistryImpl::BuilderImpl::build() { | 243 void WebBlobRegistryImpl::BuilderImpl::build() { |
237 BlobTransportController::InitiateBlobTransfer( | 244 BlobTransportController::InitiateBlobTransfer( |
238 uuid_, content_type_, std::move(consolidation_), sender_, | 245 uuid_, content_type_, std::move(consolidation_), sender_, |
239 io_runner_.get(), main_runner_); | 246 io_runner_.get(), main_runner_); |
240 } | 247 } |
241 | 248 |
242 } // namespace content | 249 } // namespace content |
OLD | NEW |