| 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 "content/child/child_process.h" | 7 #include "content/child/child_process.h" |
| 8 #include "content/child/child_thread.h" | 8 #include "content/child/child_thread.h" |
| 9 #include "content/child/resource_dispatcher.h" | 9 #include "content/child/resource_dispatcher.h" |
| 10 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 new base::WeakPtrFactory<ThreadedDataProvider>(this)); | 141 new base::WeakPtrFactory<ThreadedDataProvider>(this)); |
| 142 | 142 |
| 143 filter_ = new DataProviderMessageFilter( | 143 filter_ = new DataProviderMessageFilter( |
| 144 ChildProcess::current()->io_message_loop_proxy(), | 144 ChildProcess::current()->io_message_loop_proxy(), |
| 145 main_thread_message_loop_, | 145 main_thread_message_loop_, |
| 146 background_thread_, | 146 background_thread_, |
| 147 background_thread_weak_factory_->GetWeakPtr(), | 147 background_thread_weak_factory_->GetWeakPtr(), |
| 148 main_thread_weak_factory_.GetWeakPtr(), | 148 main_thread_weak_factory_.GetWeakPtr(), |
| 149 request_id); | 149 request_id); |
| 150 | 150 |
| 151 ChildThread::current()->channel()->AddFilter(filter_); | 151 ChildThread::current()->channel()->AddFilter(filter_.get()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 ThreadedDataProvider::~ThreadedDataProvider() { | 154 ThreadedDataProvider::~ThreadedDataProvider() { |
| 155 DCHECK(ChildThread::current()); | 155 DCHECK(ChildThread::current()); |
| 156 | 156 |
| 157 ChildThread::current()->channel()->RemoveFilter(filter_); | 157 ChildThread::current()->channel()->RemoveFilter(filter_.get()); |
| 158 | 158 |
| 159 delete threaded_data_receiver_; | 159 delete threaded_data_receiver_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void DestructOnMainThread(ThreadedDataProvider* data_provider) { | 162 void DestructOnMainThread(ThreadedDataProvider* data_provider) { |
| 163 DCHECK(ChildThread::current()); | 163 DCHECK(ChildThread::current()); |
| 164 | 164 |
| 165 // The ThreadedDataProvider must be destructed on the main thread to | 165 // The ThreadedDataProvider must be destructed on the main thread to |
| 166 // be threadsafe when removing the message filter and releasing the shared | 166 // be threadsafe when removing the message filter and releasing the shared |
| 167 // memory buffer. | 167 // memory buffer. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 // TODO(oysteine): SiteIsolationPolicy needs to be be checked | 281 // TODO(oysteine): SiteIsolationPolicy needs to be be checked |
| 282 // here before we pass the data to the data provider | 282 // here before we pass the data to the data provider |
| 283 // (or earlier on the I/O thread), otherwise once SiteIsolationPolicy does | 283 // (or earlier on the I/O thread), otherwise once SiteIsolationPolicy does |
| 284 // actual blocking as opposed to just UMA logging this will bypass it. | 284 // actual blocking as opposed to just UMA logging this will bypass it. |
| 285 threaded_data_receiver_->acceptData(data, data_length); | 285 threaded_data_receiver_->acceptData(data, data_length); |
| 286 ipc_channel_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_)); | 286 ipc_channel_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace content | 289 } // namespace content |
| OLD | NEW |