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

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

Issue 818833004: Remove deprecated methods from Pickle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 12 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 (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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // ResourceDispatcher implementation ------------------------------------------ 304 // ResourceDispatcher implementation ------------------------------------------
305 305
306 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { 306 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) {
307 if (!IsResourceDispatcherMessage(message)) { 307 if (!IsResourceDispatcherMessage(message)) {
308 return false; 308 return false;
309 } 309 }
310 310
311 int request_id; 311 int request_id;
312 312
313 PickleIterator iter(message); 313 PickleIterator iter(message);
314 if (!message.ReadInt(&iter, &request_id)) { 314 if (!iter.ReadInt(&request_id)) {
315 NOTREACHED() << "malformed resource message"; 315 NOTREACHED() << "malformed resource message";
316 return true; 316 return true;
317 } 317 }
318 318
319 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 319 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
320 if (!request_info) { 320 if (!request_info) {
321 // Release resources in the message if it is a data message. 321 // Release resources in the message if it is a data message.
322 ReleaseResourcesInDataMessage(message); 322 ReleaseResourcesInDataMessage(message);
323 return true; 323 return true;
324 } 324 }
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 867 }
868 868
869 return false; 869 return false;
870 } 870 }
871 871
872 // static 872 // static
873 void ResourceDispatcher::ReleaseResourcesInDataMessage( 873 void ResourceDispatcher::ReleaseResourcesInDataMessage(
874 const IPC::Message& message) { 874 const IPC::Message& message) {
875 PickleIterator iter(message); 875 PickleIterator iter(message);
876 int request_id; 876 int request_id;
877 if (!message.ReadInt(&iter, &request_id)) { 877 if (!iter.ReadInt(&request_id)) {
878 NOTREACHED() << "malformed resource message"; 878 NOTREACHED() << "malformed resource message";
879 return; 879 return;
880 } 880 }
881 881
882 // If the message contains a shared memory handle, we should close the handle 882 // If the message contains a shared memory handle, we should close the handle
883 // or there will be a memory leak. 883 // or there will be a memory leak.
884 if (message.type() == ResourceMsg_SetDataBuffer::ID) { 884 if (message.type() == ResourceMsg_SetDataBuffer::ID) {
885 base::SharedMemoryHandle shm_handle; 885 base::SharedMemoryHandle shm_handle;
886 if (IPC::ParamTraits<base::SharedMemoryHandle>::Read(&message, 886 if (IPC::ParamTraits<base::SharedMemoryHandle>::Read(&message,
887 &iter, 887 &iter,
888 &shm_handle)) { 888 &shm_handle)) {
889 if (base::SharedMemory::IsHandleValid(shm_handle)) 889 if (base::SharedMemory::IsHandleValid(shm_handle))
890 base::SharedMemory::CloseHandle(shm_handle); 890 base::SharedMemory::CloseHandle(shm_handle);
891 } 891 }
892 } 892 }
893 } 893 }
894 894
895 // static 895 // static
896 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 896 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
897 while (!queue->empty()) { 897 while (!queue->empty()) {
898 IPC::Message* message = queue->front(); 898 IPC::Message* message = queue->front();
899 ReleaseResourcesInDataMessage(*message); 899 ReleaseResourcesInDataMessage(*message);
900 queue->pop_front(); 900 queue->pop_front();
901 delete message; 901 delete message;
902 } 902 }
903 } 903 }
904 904
905 } // namespace content 905 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/child/threaded_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698