| 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 #ifndef CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ | 5 #ifndef CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ |
| 6 #define CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ | 6 #define CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace IPC { | 23 namespace IPC { |
| 24 class SyncChannel; | 24 class SyncChannel; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace scheduler { | 27 namespace scheduler { |
| 28 class WebThreadImplForWorkerScheduler; | 28 class WebThreadImplForWorkerScheduler; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace content { | 31 namespace content { |
| 32 class RefCountedSharedMemory; |
| 32 class ResourceDispatcher; | 33 class ResourceDispatcher; |
| 33 | 34 |
| 34 class ThreadedDataProvider { | 35 class ThreadedDataProvider { |
| 35 public: | 36 public: |
| 36 ThreadedDataProvider( | 37 ThreadedDataProvider( |
| 37 int request_id, | 38 int request_id, |
| 38 blink::WebThreadedDataReceiver* threaded_data_receiver, | 39 blink::WebThreadedDataReceiver* threaded_data_receiver, |
| 39 linked_ptr<base::SharedMemory> shm_buffer, | 40 scoped_refptr<RefCountedSharedMemory> shm_buffer, |
| 40 int shm_size, | 41 int shm_size, |
| 41 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_); | 42 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_); |
| 42 | 43 |
| 43 // Any destruction of this class has to bounce via the background thread to | 44 // Any destruction of this class has to bounce via the background thread to |
| 44 // ensure all data is flushed; call Stop() to start this process. | 45 // ensure all data is flushed; call Stop() to start this process. |
| 45 void Stop(); | 46 void Stop(); |
| 46 void OnReceivedDataOnBackgroundThread(int data_offset, | 47 void OnReceivedDataOnBackgroundThread(int data_offset, |
| 47 int data_length, | 48 int data_length, |
| 48 int encoded_data_length); | 49 int encoded_data_length); |
| 49 | 50 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 70 void ForwardAndACKData(const char* data, | 71 void ForwardAndACKData(const char* data, |
| 71 int data_length, | 72 int data_length, |
| 72 int encoded_data_length); | 73 int encoded_data_length); |
| 73 void DataNotifyForegroundThread( | 74 void DataNotifyForegroundThread( |
| 74 scoped_ptr<std::vector<char> > data_copy, | 75 scoped_ptr<std::vector<char> > data_copy, |
| 75 int data_length, | 76 int data_length, |
| 76 int encoded_data_length); | 77 int encoded_data_length); |
| 77 | 78 |
| 78 scoped_refptr<IPC::MessageFilter> filter_; | 79 scoped_refptr<IPC::MessageFilter> filter_; |
| 79 int request_id_; | 80 int request_id_; |
| 80 linked_ptr<base::SharedMemory> shm_buffer_; | 81 scoped_refptr<RefCountedSharedMemory> shm_buffer_; |
| 81 int shm_size_; | 82 int shm_size_; |
| 82 scoped_ptr<base::WeakPtrFactory<ThreadedDataProvider> > | 83 scoped_ptr<base::WeakPtrFactory<ThreadedDataProvider> > |
| 83 background_thread_weak_factory_; | 84 background_thread_weak_factory_; |
| 84 scheduler::WebThreadImplForWorkerScheduler& background_thread_; | 85 scheduler::WebThreadImplForWorkerScheduler& background_thread_; |
| 85 IPC::SyncChannel* ipc_channel_; | 86 IPC::SyncChannel* ipc_channel_; |
| 86 blink::WebThreadedDataReceiver* threaded_data_receiver_; | 87 blink::WebThreadedDataReceiver* threaded_data_receiver_; |
| 87 bool resource_filter_active_; | 88 bool resource_filter_active_; |
| 88 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 89 | 90 |
| 90 struct QueuedSharedMemoryData { | 91 struct QueuedSharedMemoryData { |
| 91 const char* data; | 92 const char* data; |
| 92 int length; | 93 int length; |
| 93 int encoded_length; | 94 int encoded_length; |
| 94 }; | 95 }; |
| 95 std::vector<QueuedSharedMemoryData> queued_data_; | 96 std::vector<QueuedSharedMemoryData> queued_data_; |
| 96 | 97 |
| 97 base::WeakPtrFactory<ThreadedDataProvider> | 98 base::WeakPtrFactory<ThreadedDataProvider> |
| 98 main_thread_weak_factory_; | 99 main_thread_weak_factory_; |
| 99 | 100 |
| 100 DISALLOW_COPY_AND_ASSIGN(ThreadedDataProvider); | 101 DISALLOW_COPY_AND_ASSIGN(ThreadedDataProvider); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace content | 104 } // namespace content |
| 104 | 105 |
| 105 #endif // CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ | 106 #endif // CONTENT_CHILD_THREADED_DATA_PROVIDER_H_ |
| OLD | NEW |