Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h

Issue 10386080: Rename nacl::RefCounted to nacl::RefCountedThreadSafe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: License bump Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_ 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_ 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 #include "native_client/src/include/nacl_base.h" 9 #include "native_client/src/include/nacl_base.h"
10 #include "native_client/src/include/nacl_macros.h" 10 #include "native_client/src/include/nacl_macros.h"
(...skipping 13 matching lines...) Expand all
24 AUDIO_PLAYING // Audio in playback 24 AUDIO_PLAYING // Audio in playback
25 }; 25 };
26 26
27 // Implements the untrusted side of the PPB_Audio interface. 27 // Implements the untrusted side of the PPB_Audio interface.
28 // All methods in PluginAudio class will be invoked on the main thread. 28 // All methods in PluginAudio class will be invoked on the main thread.
29 // The only exception is AudioThread(), which will invoke the application 29 // The only exception is AudioThread(), which will invoke the application
30 // supplied callback to periodically obtain more audio data. 30 // supplied callback to periodically obtain more audio data.
31 class PluginAudio : public PluginResource { 31 class PluginAudio : public PluginResource {
32 public: 32 public:
33 PluginAudio(); 33 PluginAudio();
34 virtual ~PluginAudio();
35 void StreamCreated(NaClSrpcImcDescType socket, 34 void StreamCreated(NaClSrpcImcDescType socket,
36 NaClSrpcImcDescType shm, size_t shm_size); 35 NaClSrpcImcDescType shm, size_t shm_size);
37 void set_state(PluginAudioState state) { state_ = state; } 36 void set_state(PluginAudioState state) { state_ = state; }
38 void set_callback(PPB_Audio_Callback user_callback, void* user_data) { 37 void set_callback(PPB_Audio_Callback user_callback, void* user_data) {
39 user_callback_ = user_callback; 38 user_callback_ = user_callback;
40 user_data_ = user_data; 39 user_data_ = user_data;
41 } 40 }
42 PluginAudioState state() { return state_; } 41 PluginAudioState state() { return state_; }
43 bool StartAudioThread(); 42 bool StartAudioThread();
44 bool StopAudioThread(); 43 bool StopAudioThread();
45 static void AudioThread(void* self); 44 static void AudioThread(void* self);
46 static const PPB_Audio* GetInterface(); 45 static const PPB_Audio* GetInterface();
47 virtual bool InitFromBrowserResource(PP_Resource resource); 46 virtual bool InitFromBrowserResource(PP_Resource resource);
47
48 protected:
49 virtual ~PluginAudio();
50
48 private: 51 private:
49 PP_Resource resource_; 52 PP_Resource resource_;
50 NaClSrpcImcDescType socket_; 53 NaClSrpcImcDescType socket_;
51 NaClSrpcImcDescType shm_; 54 NaClSrpcImcDescType shm_;
52 size_t shm_size_; 55 size_t shm_size_;
53 void *shm_buffer_; 56 void *shm_buffer_;
54 PluginAudioState state_; 57 PluginAudioState state_;
55 uintptr_t thread_id_; 58 uintptr_t thread_id_;
56 bool thread_active_; 59 bool thread_active_;
57 PPB_Audio_Callback user_callback_; 60 PPB_Audio_Callback user_callback_;
58 void* user_data_; 61 void* user_data_;
62
59 IMPLEMENT_RESOURCE(PluginAudio); 63 IMPLEMENT_RESOURCE(PluginAudio);
60 NACL_DISALLOW_COPY_AND_ASSIGN(PluginAudio); 64 NACL_DISALLOW_COPY_AND_ASSIGN(PluginAudio);
61 }; 65 };
62 66
63 } // namespace ppapi_proxy 67 } // namespace ppapi_proxy
64 68
65 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_ 69 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_AUDIO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698