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

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

Issue 1619363002: Add compile time checks against longs being used in IPC structs on 32 bit Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more per Dmitry Created 4 years, 11 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
OLDNEW
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/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 CHECK(shared_memory.get()); 147 CHECK(shared_memory.get());
148 if (!shared_memory->Map(shared_memory_size)) 148 if (!shared_memory->Map(shared_memory_size))
149 CHECK(false); 149 CHECK(false);
150 150
151 size_t remaining_bytes = length; 151 size_t remaining_bytes = length;
152 const char* current_ptr = data; 152 const char* current_ptr = data;
153 while (remaining_bytes) { 153 while (remaining_bytes) {
154 size_t chunk_size = std::min(remaining_bytes, shared_memory_size); 154 size_t chunk_size = std::min(remaining_bytes, shared_memory_size);
155 memcpy(shared_memory->memory(), current_ptr, chunk_size); 155 memcpy(shared_memory->memory(), current_ptr, chunk_size);
156 sender_->Send(new StreamHostMsg_SyncAppendSharedMemory( 156 sender_->Send(new StreamHostMsg_SyncAppendSharedMemory(
157 url, shared_memory->handle(), chunk_size)); 157 url, shared_memory->handle(), static_cast<uint32_t>(chunk_size)));
158 remaining_bytes -= chunk_size; 158 remaining_bytes -= chunk_size;
159 current_ptr += chunk_size; 159 current_ptr += chunk_size;
160 } 160 }
161 } 161 }
162 } 162 }
163 163
164 void WebBlobRegistryImpl::flushStream(const WebURL& url) { 164 void WebBlobRegistryImpl::flushStream(const WebURL& url) {
165 DCHECK(ChildThreadImpl::current()); 165 DCHECK(ChildThreadImpl::current());
166 sender_->Send(new StreamHostMsg_Flush(url)); 166 sender_->Send(new StreamHostMsg_Flush(url));
167 } 167 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 const bool mapped = shared_memory->Map(shared_memory_size); 293 const bool mapped = shared_memory->Map(shared_memory_size);
294 CHECK(mapped) << "Unable to map shared memory."; 294 CHECK(mapped) << "Unable to map shared memory.";
295 295
296 size_t offset = 0; 296 size_t offset = 0;
297 while (data_size) { 297 while (data_size) {
298 TRACE_EVENT0("Blob", "Registry::SendOversizedBlobItem"); 298 TRACE_EVENT0("Blob", "Registry::SendOversizedBlobItem");
299 size_t chunk_size = std::min(data_size, shared_memory_size); 299 size_t chunk_size = std::min(data_size, shared_memory_size);
300 consolidation_.ReadMemory(consolidated_item_index, offset, chunk_size, 300 consolidation_.ReadMemory(consolidated_item_index, offset, chunk_size,
301 shared_memory->memory()); 301 shared_memory->memory());
302 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory( 302 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory(
303 uuid_, shared_memory->handle(), chunk_size)); 303 uuid_, shared_memory->handle(), static_cast<uint32_t>(chunk_size)));
304 data_size -= chunk_size; 304 data_size -= chunk_size;
305 offset += chunk_size; 305 offset += chunk_size;
306 } 306 }
307 } 307 }
308 308
309 } // namespace content 309 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698