| 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/webblobregistry_impl.h" | 5 #include "content/child/webblobregistry_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 size_t chunk_size = std::min(remaining_bytes, shared_memory_size); | 187 size_t chunk_size = std::min(remaining_bytes, shared_memory_size); |
| 188 memcpy(shared_memory->memory(), current_ptr, chunk_size); | 188 memcpy(shared_memory->memory(), current_ptr, chunk_size); |
| 189 sender_->Send(new StreamHostMsg_SyncAppendSharedMemory( | 189 sender_->Send(new StreamHostMsg_SyncAppendSharedMemory( |
| 190 url, shared_memory->handle(), chunk_size)); | 190 url, shared_memory->handle(), chunk_size)); |
| 191 remaining_bytes -= chunk_size; | 191 remaining_bytes -= chunk_size; |
| 192 current_ptr += chunk_size; | 192 current_ptr += chunk_size; |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 void WebBlobRegistryImpl::flushStream(const WebURL& url) { |
| 198 DCHECK(ChildThread::current()); |
| 199 sender_->Send(new StreamHostMsg_Flush(url)); |
| 200 } |
| 201 |
| 197 void WebBlobRegistryImpl::finalizeStream(const WebURL& url) { | 202 void WebBlobRegistryImpl::finalizeStream(const WebURL& url) { |
| 198 DCHECK(ChildThread::current()); | 203 DCHECK(ChildThread::current()); |
| 199 sender_->Send(new StreamHostMsg_FinishBuilding(url)); | 204 sender_->Send(new StreamHostMsg_FinishBuilding(url)); |
| 200 } | 205 } |
| 201 | 206 |
| 202 void WebBlobRegistryImpl::abortStream(const WebURL& url) { | 207 void WebBlobRegistryImpl::abortStream(const WebURL& url) { |
| 203 DCHECK(ChildThread::current()); | 208 DCHECK(ChildThread::current()); |
| 204 sender_->Send(new StreamHostMsg_AbortBuilding(url)); | 209 sender_->Send(new StreamHostMsg_AbortBuilding(url)); |
| 205 } | 210 } |
| 206 | 211 |
| 207 void WebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) { | 212 void WebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) { |
| 208 DCHECK(ChildThread::current()); | 213 DCHECK(ChildThread::current()); |
| 209 sender_->Send(new StreamHostMsg_Remove(url)); | 214 sender_->Send(new StreamHostMsg_Remove(url)); |
| 210 } | 215 } |
| 211 | 216 |
| 212 } // namespace content | 217 } // namespace content |
| OLD | NEW |