OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ | |
6 #define CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/memory/linked_ptr.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/shared_memory.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "ipc/ipc_channel_proxy.h" | |
15 | |
16 namespace blink { | |
17 class WebThreadedDataReceiver; | |
18 } | |
19 | |
20 namespace IPC { | |
21 class SyncChannel; | |
22 } | |
23 | |
24 namespace webkit_glue { | |
25 class WebThreadImpl; | |
26 } | |
27 | |
28 namespace content { | |
29 class ResourceDispatcher; | |
30 class WebThreadImpl; | |
31 | |
32 class ThreadedDataProvider { | |
33 public: | |
34 ThreadedDataProvider( | |
35 int request_id, | |
36 blink::WebThreadedDataReceiver* threaded_data_receiver, | |
37 linked_ptr<base::SharedMemory> shm_buffer, | |
38 int shm_size); | |
39 virtual ~ThreadedDataProvider(); | |
40 | |
41 void Stop(); | |
42 void OnReceivedDataOnBackgroundThread(int data_offset, | |
43 int data_length, | |
44 int encoded_data_length); | |
45 | |
46 void OnReceivedDataOnForegroundThread(const char* data, | |
47 int data_length, | |
48 int encoded_data_length); | |
49 | |
50 void OnResourceMessageFilterAddedMainThread(); | |
51 | |
52 private: | |
53 void StopOnBackgroundThread(); | |
54 void OnResourceMessageFilterAddedBackgroundThread(); | |
55 void ForwardAndACKData(const char* data, int data_length); | |
56 | |
57 scoped_refptr<IPC::ChannelProxy::MessageFilter> filter_; | |
58 int request_id_; | |
59 linked_ptr<base::SharedMemory> shm_buffer_; | |
60 int shm_size_; | |
61 base::WeakPtrFactory<ThreadedDataProvider> | |
62 background_thread_weak_factory_; | |
63 base::WeakPtrFactory<ThreadedDataProvider> | |
64 main_thread_weak_factory_; | |
65 WebThreadImpl& background_thread_; | |
66 IPC::SyncChannel* ipc_channel_; | |
67 blink::WebThreadedDataReceiver* threaded_data_receiver_; | |
68 bool resource_filter_active_; | |
69 base::MessageLoop* main_thread_message_loop_; | |
70 | |
71 struct QueuedSharedMemoryData { | |
72 const char* data; | |
73 int length; | |
74 }; | |
75 std::vector<QueuedSharedMemoryData> queued_data_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(ThreadedDataProvider); | |
78 }; | |
79 | |
80 } // namespace content | |
81 | |
82 #endif // CONTENT_CHILD_THREADEDDATAPROVIDER_IMPL_H_ | |
OLD | NEW |