| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/threaded_data_provider.h" | 5 #include "content/child/threaded_data_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 return false; | 108 return false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void DataProviderMessageFilter::OnReceivedData(int request_id, | 111 void DataProviderMessageFilter::OnReceivedData(int request_id, |
| 112 int data_offset, | 112 int data_offset, |
| 113 int data_length, | 113 int data_length, |
| 114 int encoded_data_length) { | 114 int encoded_data_length) { |
| 115 TRACE_EVENT0("loader", "DataProviderMessageFilter::OnReceivedData"); |
| 115 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 116 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 116 background_thread_.TaskRunner()->PostTask( | 117 background_thread_.TaskRunner()->PostTask( |
| 117 FROM_HERE, | 118 FROM_HERE, |
| 118 base::Bind(&ThreadedDataProvider::OnReceivedDataOnBackgroundThread, | 119 base::Bind(&ThreadedDataProvider::OnReceivedDataOnBackgroundThread, |
| 119 background_thread_resource_provider_, data_offset, data_length, | 120 background_thread_resource_provider_, data_offset, data_length, |
| 120 encoded_data_length)); | 121 encoded_data_length)); |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // anonymous namespace | 124 } // anonymous namespace |
| 124 | 125 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 queued_data.data = data_ptr + data_offset; | 297 queued_data.data = data_ptr + data_offset; |
| 297 queued_data.length = data_length; | 298 queued_data.length = data_length; |
| 298 queued_data.encoded_length = encoded_data_length; | 299 queued_data.encoded_length = encoded_data_length; |
| 299 queued_data_.push_back(queued_data); | 300 queued_data_.push_back(queued_data); |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 void ThreadedDataProvider::OnReceivedDataOnForegroundThread( | 304 void ThreadedDataProvider::OnReceivedDataOnForegroundThread( |
| 304 const char* data, int data_length, int encoded_data_length) { | 305 const char* data, int data_length, int encoded_data_length) { |
| 305 DCHECK(ChildThreadImpl::current()); | 306 DCHECK(ChildThreadImpl::current()); |
| 307 TRACE_EVENT0("loader", |
| 308 "ThreadedDataProvider::OnReceivedDataOnForegroundThread"); |
| 306 | 309 |
| 307 background_thread_.TaskRunner()->PostTask( | 310 background_thread_.TaskRunner()->PostTask( |
| 308 FROM_HERE, base::Bind(&ThreadedDataProvider::ForwardAndACKData, | 311 FROM_HERE, base::Bind(&ThreadedDataProvider::ForwardAndACKData, |
| 309 base::Unretained(this), data, data_length, | 312 base::Unretained(this), data, data_length, |
| 310 encoded_data_length)); | 313 encoded_data_length)); |
| 311 } | 314 } |
| 312 | 315 |
| 313 void ThreadedDataProvider::ForwardAndACKData(const char* data, | 316 void ThreadedDataProvider::ForwardAndACKData(const char* data, |
| 314 int data_length, | 317 int data_length, |
| 315 int encoded_data_length) { | 318 int encoded_data_length) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 340 DCHECK(threaded_data_receiver_->needsMainthreadDataCopy()); | 343 DCHECK(threaded_data_receiver_->needsMainthreadDataCopy()); |
| 341 DCHECK_EQ((size_t)data_length, data_copy->size()); | 344 DCHECK_EQ((size_t)data_length, data_copy->size()); |
| 342 } | 345 } |
| 343 | 346 |
| 344 threaded_data_receiver_->acceptMainthreadDataNotification( | 347 threaded_data_receiver_->acceptMainthreadDataNotification( |
| 345 (data_copy && !data_copy->empty()) ? &data_copy->front() : NULL, | 348 (data_copy && !data_copy->empty()) ? &data_copy->front() : NULL, |
| 346 data_length, encoded_data_length); | 349 data_length, encoded_data_length); |
| 347 } | 350 } |
| 348 | 351 |
| 349 } // namespace content | 352 } // namespace content |
| OLD | NEW |