OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/fileapi/webblobregistry_impl.h" | 5 #include "content/common/fileapi/webblobregistry_impl.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "content/common/child_thread.h" | 10 #include "content/common/child_thread.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 WebBlobRegistryImpl::WebBlobRegistryImpl(ThreadSafeSender* sender) | 25 WebBlobRegistryImpl::WebBlobRegistryImpl(ThreadSafeSender* sender) |
26 : sender_(sender) { | 26 : sender_(sender) { |
27 } | 27 } |
28 | 28 |
29 WebBlobRegistryImpl::~WebBlobRegistryImpl() { | 29 WebBlobRegistryImpl::~WebBlobRegistryImpl() { |
30 } | 30 } |
31 | 31 |
32 void WebBlobRegistryImpl::registerBlobURL( | 32 void WebBlobRegistryImpl::registerBlobURL( |
33 const WebURL& url, WebBlobData& data) { | 33 const WebURL& url, WebBlobData& data) { |
34 DCHECK(ChildThread::current()->message_loop() == MessageLoop::current()); | 34 DCHECK(ChildThread::current()->message_loop() == |
| 35 base::MessageLoop::current()); |
35 const size_t kLargeThresholdBytes = 250 * 1024; | 36 const size_t kLargeThresholdBytes = 250 * 1024; |
36 const size_t kMaxSharedMemoryBytes = 10 * 1024 * 1024; | 37 const size_t kMaxSharedMemoryBytes = 10 * 1024 * 1024; |
37 | 38 |
38 sender_->Send(new BlobHostMsg_StartBuildingBlob(url)); | 39 sender_->Send(new BlobHostMsg_StartBuildingBlob(url)); |
39 size_t i = 0; | 40 size_t i = 0; |
40 WebBlobData::Item data_item; | 41 WebBlobData::Item data_item; |
41 while (data.itemAt(i++, data_item)) { | 42 while (data.itemAt(i++, data_item)) { |
42 webkit_blob::BlobData::Item item; | 43 webkit_blob::BlobData::Item item; |
43 switch (data_item.type) { | 44 switch (data_item.type) { |
44 case WebBlobData::Item::TypeData: { | 45 case WebBlobData::Item::TypeData: { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 default: | 105 default: |
105 NOTREACHED(); | 106 NOTREACHED(); |
106 } | 107 } |
107 } | 108 } |
108 sender_->Send(new BlobHostMsg_FinishBuildingBlob( | 109 sender_->Send(new BlobHostMsg_FinishBuildingBlob( |
109 url, data.contentType().utf8().data())); | 110 url, data.contentType().utf8().data())); |
110 } | 111 } |
111 | 112 |
112 void WebBlobRegistryImpl::registerBlobURL( | 113 void WebBlobRegistryImpl::registerBlobURL( |
113 const WebURL& url, const WebURL& src_url) { | 114 const WebURL& url, const WebURL& src_url) { |
114 DCHECK(ChildThread::current()->message_loop() == MessageLoop::current()); | 115 DCHECK(ChildThread::current()->message_loop() == |
| 116 base::MessageLoop::current()); |
115 sender_->Send(new BlobHostMsg_CloneBlob(url, src_url)); | 117 sender_->Send(new BlobHostMsg_CloneBlob(url, src_url)); |
116 } | 118 } |
117 | 119 |
118 void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { | 120 void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { |
119 DCHECK(ChildThread::current()->message_loop() == MessageLoop::current()); | 121 DCHECK(ChildThread::current()->message_loop() == |
| 122 base::MessageLoop::current()); |
120 sender_->Send(new BlobHostMsg_RemoveBlob(url)); | 123 sender_->Send(new BlobHostMsg_RemoveBlob(url)); |
121 } | 124 } |
122 | 125 |
123 } // namespace content | 126 } // namespace content |
OLD | NEW |