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

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

Issue 1334593002: Reland #2 "ipc: Add a new field num_brokered_attachments to the message header." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and type error. Created 5 years, 3 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
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/child/resource_scheduling_filter.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 // 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 delegate_(NULL), 73 delegate_(NULL),
74 io_timestamp_(base::TimeTicks()), 74 io_timestamp_(base::TimeTicks()),
75 main_thread_task_runner_(main_thread_task_runner), 75 main_thread_task_runner_(main_thread_task_runner),
76 weak_factory_(this) { 76 weak_factory_(this) {
77 } 77 }
78 78
79 ResourceDispatcher::~ResourceDispatcher() { 79 ResourceDispatcher::~ResourceDispatcher() {
80 } 80 }
81 81
82 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { 82 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) {
83 // TODO(erikchen): Temporary code to help track http://crbug.com/527588.
84 content::CheckContentsOfDataReceivedMessage(&message);
85
83 if (!IsResourceDispatcherMessage(message)) { 86 if (!IsResourceDispatcherMessage(message)) {
84 return false; 87 return false;
85 } 88 }
86 89
87 int request_id; 90 int request_id;
88 91
89 base::PickleIterator iter(message); 92 base::PickleIterator iter(message);
90 if (!iter.ReadInt(&request_id)) { 93 if (!iter.ReadInt(&request_id)) {
91 NOTREACHED() << "malformed resource message"; 94 NOTREACHED() << "malformed resource message";
92 return true; 95 return true;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 215
213 void ResourceDispatcher::OnReceivedData(int request_id, 216 void ResourceDispatcher::OnReceivedData(int request_id,
214 int data_offset, 217 int data_offset,
215 int data_length, 218 int data_length,
216 int encoded_data_length) { 219 int encoded_data_length) {
217 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData"); 220 TRACE_EVENT0("loader", "ResourceDispatcher::OnReceivedData");
218 DCHECK_GT(data_length, 0); 221 DCHECK_GT(data_length, 0);
219 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 222 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
220 bool send_ack = true; 223 bool send_ack = true;
221 if (request_info && data_length > 0) { 224 if (request_info && data_length > 0) {
225 // TODO(erikchen): Temporary code to help track http://crbug.com/527588.
226 int buffer_size = request_info->buffer_size;
227
222 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle())); 228 CHECK(base::SharedMemory::IsHandleValid(request_info->buffer->handle()));
223 CHECK_GE(request_info->buffer_size, data_offset + data_length); 229 CHECK_GE(request_info->buffer_size, data_offset + data_length);
224 230
231 // TODO(erikchen): Temporary code to help track http://crbug.com/527588.
232 base::debug::Alias(request_info);
233 base::debug::Alias(&buffer_size);
234
225 // Ensure that the SHM buffer remains valid for the duration of this scope. 235 // Ensure that the SHM buffer remains valid for the duration of this scope.
226 // It is possible for Cancel() to be called before we exit this scope. 236 // It is possible for Cancel() to be called before we exit this scope.
227 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it. 237 // SharedMemoryReceivedDataFactory stores the SHM buffer inside it.
228 scoped_refptr<SharedMemoryReceivedDataFactory> factory( 238 scoped_refptr<SharedMemoryReceivedDataFactory> factory(
229 request_info->received_data_factory); 239 request_info->received_data_factory);
230 240
231 base::TimeTicks time_start = base::TimeTicks::Now(); 241 base::TimeTicks time_start = base::TimeTicks::Now();
232 242
233 const char* data_start = static_cast<char*>(request_info->buffer->memory()); 243 const char* data_start = static_cast<char*>(request_info->buffer->memory());
234 CHECK(data_start); 244 CHECK(data_start);
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 extra_data->transferred_request_request_id(); 798 extra_data->transferred_request_request_id();
789 request->service_worker_provider_id = 799 request->service_worker_provider_id =
790 extra_data->service_worker_provider_id(); 800 extra_data->service_worker_provider_id();
791 request->request_body = request_body; 801 request->request_body = request_body;
792 if (frame_origin) 802 if (frame_origin)
793 *frame_origin = extra_data->frame_origin(); 803 *frame_origin = extra_data->frame_origin();
794 return request.Pass(); 804 return request.Pass();
795 } 805 }
796 806
797 } // namespace content 807 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/child/resource_scheduling_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698