| 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 13 matching lines...) Expand all Loading... |
| 24 const scoped_refptr<base::MessageLoopProxy>& io_message_loop, | 24 const scoped_refptr<base::MessageLoopProxy>& io_message_loop, |
| 25 base::MessageLoop* main_thread_message_loop, | 25 base::MessageLoop* main_thread_message_loop, |
| 26 const WebThreadImpl& background_thread, | 26 const WebThreadImpl& background_thread, |
| 27 const base::WeakPtr<ThreadedDataProvider>& | 27 const base::WeakPtr<ThreadedDataProvider>& |
| 28 background_thread_resource_provider, | 28 background_thread_resource_provider, |
| 29 const base::WeakPtr<ThreadedDataProvider>& | 29 const base::WeakPtr<ThreadedDataProvider>& |
| 30 main_thread_resource_provider, | 30 main_thread_resource_provider, |
| 31 int request_id); | 31 int request_id); |
| 32 | 32 |
| 33 // IPC::ChannelProxy::MessageFilter | 33 // IPC::ChannelProxy::MessageFilter |
| 34 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE FINAL; | 34 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE FINAL; |
| 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE FINAL; | 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE FINAL; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 virtual ~DataProviderMessageFilter() { } | 38 virtual ~DataProviderMessageFilter() { } |
| 39 | 39 |
| 40 void OnReceivedData(int request_id, int data_offset, int data_length, | 40 void OnReceivedData(int request_id, int data_offset, int data_length, |
| 41 int encoded_data_length); | 41 int encoded_data_length); |
| 42 | 42 |
| 43 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 43 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 44 base::MessageLoop* main_thread_message_loop_; | 44 base::MessageLoop* main_thread_message_loop_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 int request_id) | 63 int request_id) |
| 64 : io_message_loop_(io_message_loop), | 64 : io_message_loop_(io_message_loop), |
| 65 main_thread_message_loop_(main_thread_message_loop), | 65 main_thread_message_loop_(main_thread_message_loop), |
| 66 background_thread_(background_thread), | 66 background_thread_(background_thread), |
| 67 background_thread_resource_provider_(background_thread_resource_provider), | 67 background_thread_resource_provider_(background_thread_resource_provider), |
| 68 main_thread_resource_provider_(main_thread_resource_provider), | 68 main_thread_resource_provider_(main_thread_resource_provider), |
| 69 request_id_(request_id) { | 69 request_id_(request_id) { |
| 70 DCHECK(main_thread_message_loop != NULL); | 70 DCHECK(main_thread_message_loop != NULL); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void DataProviderMessageFilter::OnFilterAdded(IPC::Channel* channel) { | 73 void DataProviderMessageFilter::OnFilterAdded(IPC::Sender* sender) { |
| 74 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 74 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
| 75 | 75 |
| 76 main_thread_message_loop_->PostTask(FROM_HERE, | 76 main_thread_message_loop_->PostTask(FROM_HERE, |
| 77 base::Bind( | 77 base::Bind( |
| 78 &ThreadedDataProvider::OnResourceMessageFilterAddedMainThread, | 78 &ThreadedDataProvider::OnResourceMessageFilterAddedMainThread, |
| 79 main_thread_resource_provider_)); | 79 main_thread_resource_provider_)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool DataProviderMessageFilter::OnMessageReceived( | 82 bool DataProviderMessageFilter::OnMessageReceived( |
| 83 const IPC::Message& message) { | 83 const IPC::Message& message) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 // TODO(oysteine): SiteIsolationPolicy needs to be be checked | 270 // TODO(oysteine): SiteIsolationPolicy needs to be be checked |
| 271 // here before we pass the data to the data provider | 271 // here before we pass the data to the data provider |
| 272 // (or earlier on the I/O thread), otherwise once SiteIsolationPolicy does | 272 // (or earlier on the I/O thread), otherwise once SiteIsolationPolicy does |
| 273 // actual blocking as opposed to just UMA logging this will bypass it. | 273 // actual blocking as opposed to just UMA logging this will bypass it. |
| 274 threaded_data_receiver_->acceptData(data, data_length); | 274 threaded_data_receiver_->acceptData(data, data_length); |
| 275 ipc_channel_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_)); | 275 ipc_channel_->Send(new ResourceHostMsg_DataReceived_ACK(request_id_)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace content | 278 } // namespace content |
| OLD | NEW |