Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: content/common_child/webblobregistry_impl.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common_child/npobject_stub.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_child/webblobregistry_impl.h" 5 #include "content/common_child/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 item.SetToBytes(data_item.data.data(), data_item.data.size()); 51 item.SetToBytes(data_item.data.data(), data_item.data.size());
52 sender_->Send(new BlobHostMsg_AppendBlobDataItem(url, item)); 52 sender_->Send(new BlobHostMsg_AppendBlobDataItem(url, item));
53 } else { 53 } else {
54 // We handle larger amounts of data via SharedMemory instead of 54 // We handle larger amounts of data via SharedMemory instead of
55 // writing it directly to the IPC channel. 55 // writing it directly to the IPC channel.
56 size_t data_size = data_item.data.size(); 56 size_t data_size = data_item.data.size();
57 const char* data_ptr = data_item.data.data(); 57 const char* data_ptr = data_item.data.data();
58 size_t shared_memory_size = std::min( 58 size_t shared_memory_size = std::min(
59 data_size, kMaxSharedMemoryBytes); 59 data_size, kMaxSharedMemoryBytes);
60 scoped_ptr<base::SharedMemory> shared_memory( 60 scoped_ptr<base::SharedMemory> shared_memory(
61 ChildThread::AllocateSharedMemory(shared_memory_size, sender_)); 61 ChildThread::AllocateSharedMemory(shared_memory_size,
62 sender_.get()));
62 CHECK(shared_memory.get()); 63 CHECK(shared_memory.get());
63 while (data_size) { 64 while (data_size) {
64 size_t chunk_size = std::min(data_size, shared_memory_size); 65 size_t chunk_size = std::min(data_size, shared_memory_size);
65 memcpy(shared_memory->memory(), data_ptr, chunk_size); 66 memcpy(shared_memory->memory(), data_ptr, chunk_size);
66 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory( 67 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory(
67 url, shared_memory->handle(), chunk_size)); 68 url, shared_memory->handle(), chunk_size));
68 data_size -= chunk_size; 69 data_size -= chunk_size;
69 data_ptr += chunk_size; 70 data_ptr += chunk_size;
70 } 71 }
71 } 72 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 sender_->Send(new BlobHostMsg_CloneBlob(url, src_url)); 118 sender_->Send(new BlobHostMsg_CloneBlob(url, src_url));
118 } 119 }
119 120
120 void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { 121 void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) {
121 DCHECK(ChildThread::current()->message_loop() == 122 DCHECK(ChildThread::current()->message_loop() ==
122 base::MessageLoop::current()); 123 base::MessageLoop::current());
123 sender_->Send(new BlobHostMsg_RemoveBlob(url)); 124 sender_->Send(new BlobHostMsg_RemoveBlob(url));
124 } 125 }
125 126
126 } // namespace content 127 } // namespace content
OLDNEW
« no previous file with comments | « content/common_child/npobject_stub.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698