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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 } // anonymous namespace | 119 } // anonymous namespace |
120 | 120 |
121 ThreadedDataProvider::ThreadedDataProvider( | 121 ThreadedDataProvider::ThreadedDataProvider( |
122 int request_id, blink::WebThreadedDataReceiver* threaded_data_receiver, | 122 int request_id, blink::WebThreadedDataReceiver* threaded_data_receiver, |
123 linked_ptr<base::SharedMemory> shm_buffer, int shm_size) | 123 linked_ptr<base::SharedMemory> shm_buffer, int shm_size) |
124 : request_id_(request_id), | 124 : request_id_(request_id), |
125 shm_buffer_(shm_buffer), | 125 shm_buffer_(shm_buffer), |
126 shm_size_(shm_size), | 126 shm_size_(shm_size), |
127 main_thread_weak_factory_(this), | |
128 background_thread_( | 127 background_thread_( |
129 static_cast<WebThreadImpl&>( | 128 static_cast<WebThreadImpl&>( |
130 *threaded_data_receiver->backgroundThread())), | 129 *threaded_data_receiver->backgroundThread())), |
131 ipc_channel_(ChildThread::current()->channel()), | 130 ipc_channel_(ChildThread::current()->channel()), |
132 threaded_data_receiver_(threaded_data_receiver), | 131 threaded_data_receiver_(threaded_data_receiver), |
133 resource_filter_active_(false), | 132 resource_filter_active_(false), |
134 main_thread_message_loop_(ChildThread::current()->message_loop()) { | 133 main_thread_message_loop_(ChildThread::current()->message_loop()), |
| 134 main_thread_weak_factory_(this) { |
135 DCHECK(ChildThread::current()); | 135 DCHECK(ChildThread::current()); |
136 DCHECK(ipc_channel_); | 136 DCHECK(ipc_channel_); |
137 DCHECK(threaded_data_receiver_); | 137 DCHECK(threaded_data_receiver_); |
138 DCHECK(main_thread_message_loop_); | 138 DCHECK(main_thread_message_loop_); |
139 | 139 |
140 background_thread_weak_factory_.reset( | 140 background_thread_weak_factory_.reset( |
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(), |
(...skipping 135 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 |