Chromium Code Reviews| Index: content/child/threadeddataprovider.h |
| diff --git a/content/child/threadeddataprovider.h b/content/child/threadeddataprovider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2aabfa846e8110be7e8c4f01620f725538ce5a3d |
| --- /dev/null |
| +++ b/content/child/threadeddataprovider.h |
| @@ -0,0 +1,82 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
|
darin (slow to review)
2014/03/19 03:51:28
nit: 2014
oystein (OOO til 10th of July)
2014/03/21 19:26:15
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ |
| +#define CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/linked_ptr.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/shared_memory.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "ipc/ipc_channel_proxy.h" |
| + |
| +namespace blink { |
| +class WebThreadedDataReceiver; |
| +} |
| + |
| +namespace IPC { |
| +class SyncChannel; |
| +} |
| + |
| +namespace webkit_glue { |
| +class WebThreadImpl; |
| +} |
| + |
| +namespace content { |
| +class ResourceDispatcher; |
| +class WebThreadImpl; |
| + |
| +class ThreadedDataProvider { |
| + public: |
| + ThreadedDataProvider( |
| + int request_id, |
| + blink::WebThreadedDataReceiver* threaded_data_receiver, |
| + linked_ptr<base::SharedMemory> shm_buffer, |
| + int shm_size); |
| + virtual ~ThreadedDataProvider(); |
| + |
| + void Stop(); |
| + void OnReceivedDataOnBackgroundThread(int data_offset, |
| + int data_length, |
| + int encoded_data_length); |
| + |
| + void OnReceivedDataOnForegroundThread(const char* data, |
| + int data_length, |
| + int encoded_data_length); |
| + |
| + void OnResourceMessageFilterAddedMainThread(); |
| + |
| + private: |
| + void StopOnBackgroundThread(); |
| + void OnResourceMessageFilterAddedBackgroundThread(); |
| + void ForwardAndACKData(const char* data, int data_length); |
| + |
| + scoped_refptr<IPC::ChannelProxy::MessageFilter> filter_; |
| + int request_id_; |
| + linked_ptr<base::SharedMemory> shm_buffer_; |
| + int shm_size_; |
| + base::WeakPtrFactory<ThreadedDataProvider> |
| + background_thread_weak_factory_; |
| + base::WeakPtrFactory<ThreadedDataProvider> |
| + main_thread_weak_factory_; |
| + WebThreadImpl& background_thread_; |
| + IPC::SyncChannel* ipc_channel_; |
| + blink::WebThreadedDataReceiver* threaded_data_receiver_; |
| + bool resource_filter_active_; |
| + base::MessageLoop* main_thread_message_loop_; |
| + |
| + struct QueuedSharedMemoryData { |
| + const char* data; |
| + int length; |
| + }; |
| + std::vector<QueuedSharedMemoryData> queued_data_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ThreadedDataProvider); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ |