OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ |
6 #define PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ | 6 #define PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 class ResourceMessageReplyParams; | 27 class ResourceMessageReplyParams; |
28 | 28 |
29 class AudioInputResource : public PluginResource, | 29 class AudioInputResource : public PluginResource, |
30 public thunk::PPB_AudioInput_API, | 30 public thunk::PPB_AudioInput_API, |
31 public base::DelegateSimpleThread::Delegate { | 31 public base::DelegateSimpleThread::Delegate { |
32 public: | 32 public: |
33 AudioInputResource(Connection connection, PP_Instance instance); | 33 AudioInputResource(Connection connection, PP_Instance instance); |
34 virtual ~AudioInputResource(); | 34 virtual ~AudioInputResource(); |
35 | 35 |
36 // Resource overrides. | 36 // Resource overrides. |
37 virtual thunk::PPB_AudioInput_API* AsPPB_AudioInput_API() OVERRIDE; | 37 virtual thunk::PPB_AudioInput_API* AsPPB_AudioInput_API() override; |
38 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 38 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
39 const IPC::Message& msg) OVERRIDE; | 39 const IPC::Message& msg) override; |
40 | 40 |
41 // PPB_AudioInput_API implementation. | 41 // PPB_AudioInput_API implementation. |
42 virtual int32_t EnumerateDevices( | 42 virtual int32_t EnumerateDevices( |
43 const PP_ArrayOutput& output, | 43 const PP_ArrayOutput& output, |
44 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 44 scoped_refptr<TrackedCallback> callback) override; |
45 virtual int32_t MonitorDeviceChange( | 45 virtual int32_t MonitorDeviceChange( |
46 PP_MonitorDeviceChangeCallback callback, | 46 PP_MonitorDeviceChangeCallback callback, |
47 void* user_data) OVERRIDE; | 47 void* user_data) override; |
48 virtual int32_t Open0_3(PP_Resource device_ref, | 48 virtual int32_t Open0_3(PP_Resource device_ref, |
49 PP_Resource config, | 49 PP_Resource config, |
50 PPB_AudioInput_Callback_0_3 audio_input_callback_0_3, | 50 PPB_AudioInput_Callback_0_3 audio_input_callback_0_3, |
51 void* user_data, | 51 void* user_data, |
52 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 52 scoped_refptr<TrackedCallback> callback) override; |
53 virtual int32_t Open(PP_Resource device_ref, | 53 virtual int32_t Open(PP_Resource device_ref, |
54 PP_Resource config, | 54 PP_Resource config, |
55 PPB_AudioInput_Callback audio_input_callback, | 55 PPB_AudioInput_Callback audio_input_callback, |
56 void* user_data, | 56 void* user_data, |
57 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 57 scoped_refptr<TrackedCallback> callback) override; |
58 virtual PP_Resource GetCurrentConfig() OVERRIDE; | 58 virtual PP_Resource GetCurrentConfig() override; |
59 virtual PP_Bool StartCapture() OVERRIDE; | 59 virtual PP_Bool StartCapture() override; |
60 virtual PP_Bool StopCapture() OVERRIDE; | 60 virtual PP_Bool StopCapture() override; |
61 virtual void Close() OVERRIDE; | 61 virtual void Close() override; |
62 | 62 |
63 protected: | 63 protected: |
64 // Resource override. | 64 // Resource override. |
65 virtual void LastPluginRefWasDeleted() OVERRIDE; | 65 virtual void LastPluginRefWasDeleted() override; |
66 | 66 |
67 private: | 67 private: |
68 enum OpenState { | 68 enum OpenState { |
69 BEFORE_OPEN, | 69 BEFORE_OPEN, |
70 OPENED, | 70 OPENED, |
71 CLOSED | 71 CLOSED |
72 }; | 72 }; |
73 | 73 |
74 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); | 74 void OnPluginMsgOpenReply(const ResourceMessageReplyParams& params); |
75 | 75 |
76 // Sets the shared memory and socket handles. This will automatically start | 76 // Sets the shared memory and socket handles. This will automatically start |
77 // capture if we're currently set to capture. | 77 // capture if we're currently set to capture. |
78 void SetStreamInfo(base::SharedMemoryHandle shared_memory_handle, | 78 void SetStreamInfo(base::SharedMemoryHandle shared_memory_handle, |
79 size_t shared_memory_size, | 79 size_t shared_memory_size, |
80 base::SyncSocket::Handle socket_handle); | 80 base::SyncSocket::Handle socket_handle); |
81 | 81 |
82 // Starts execution of the audio input thread. | 82 // Starts execution of the audio input thread. |
83 void StartThread(); | 83 void StartThread(); |
84 | 84 |
85 // Stops execution of the audio input thread. | 85 // Stops execution of the audio input thread. |
86 void StopThread(); | 86 void StopThread(); |
87 | 87 |
88 // DelegateSimpleThread::Delegate implementation. | 88 // DelegateSimpleThread::Delegate implementation. |
89 // Run on the audio input thread. | 89 // Run on the audio input thread. |
90 virtual void Run() OVERRIDE; | 90 virtual void Run() override; |
91 | 91 |
92 int32_t CommonOpen(PP_Resource device_ref, | 92 int32_t CommonOpen(PP_Resource device_ref, |
93 PP_Resource config, | 93 PP_Resource config, |
94 PPB_AudioInput_Callback_0_3 audio_input_callback_0_3, | 94 PPB_AudioInput_Callback_0_3 audio_input_callback_0_3, |
95 PPB_AudioInput_Callback audio_input_callback, | 95 PPB_AudioInput_Callback audio_input_callback, |
96 void* user_data, | 96 void* user_data, |
97 scoped_refptr<TrackedCallback> callback); | 97 scoped_refptr<TrackedCallback> callback); |
98 | 98 |
99 OpenState open_state_; | 99 OpenState open_state_; |
100 | 100 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 int client_buffer_size_bytes_; | 145 int client_buffer_size_bytes_; |
146 scoped_ptr<uint8_t[]> client_buffer_; | 146 scoped_ptr<uint8_t[]> client_buffer_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(AudioInputResource); | 148 DISALLOW_COPY_AND_ASSIGN(AudioInputResource); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace proxy | 151 } // namespace proxy |
152 } // namespace ppapi | 152 } // namespace ppapi |
153 | 153 |
154 #endif // PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ | 154 #endif // PPAPI_PROXY_AUDIO_INPUT_RESOURCE_H_ |
OLD | NEW |