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

Side by Side Diff: ppapi/shared_impl/audio_impl.h

Issue 7608033: Move the refcounting from the proxy/impl resource object to the shared resource object base class. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/shared_impl/audio_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 PPAPI_SHARED_IMPL_AUDIO_IMPL_H_ 5 #ifndef PPAPI_SHARED_IMPL_AUDIO_IMPL_H_
6 #define PPAPI_SHARED_IMPL_AUDIO_IMPL_H_ 6 #define PPAPI_SHARED_IMPL_AUDIO_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "base/sync_socket.h" 10 #include "base/sync_socket.h"
11 #include "base/threading/simple_thread.h" 11 #include "base/threading/simple_thread.h"
12 #include "ppapi/c/ppb_audio.h" 12 #include "ppapi/c/ppb_audio.h"
13 #include "ppapi/shared_impl/resource_object_base.h" 13 #include "ppapi/shared_impl/resource_object_base.h"
14 #include "ppapi/thunk/ppb_audio_api.h" 14 #include "ppapi/thunk/ppb_audio_api.h"
15 15
16 namespace ppapi { 16 namespace ppapi {
17 17
18 // Implements the logic to map shared memory and run the audio thread signaled 18 // Implements the logic to map shared memory and run the audio thread signaled
19 // from the sync socket. Both the proxy and the renderer implementation use 19 // from the sync socket. Both the proxy and the renderer implementation use
20 // this code. 20 // this code.
21 class AudioImpl : public ResourceObjectBase, 21 class AudioImpl : public thunk::PPB_Audio_API,
22 public thunk::PPB_Audio_API,
23 public base::DelegateSimpleThread::Delegate { 22 public base::DelegateSimpleThread::Delegate {
24 public: 23 public:
25 AudioImpl(); 24 AudioImpl();
26 virtual ~AudioImpl(); 25 virtual ~AudioImpl();
27 26
28 // ResourceObjectBase implementation.
29 virtual ::ppapi::thunk::PPB_Audio_API* AsPPB_Audio_API() OVERRIDE;
30
31 bool playing() const { return playing_; } 27 bool playing() const { return playing_; }
32 28
33 // Sets the callback information that the background thread will use. This 29 // Sets the callback information that the background thread will use. This
34 // is optional. Without a callback, the thread will not be run. This 30 // is optional. Without a callback, the thread will not be run. This
35 // non-callback mode is used in the renderer with the proxy, since the proxy 31 // non-callback mode is used in the renderer with the proxy, since the proxy
36 // handles the callback entirely within the plugin process. 32 // handles the callback entirely within the plugin process.
37 void SetCallback(PPB_Audio_Callback callback, void* user_data); 33 void SetCallback(PPB_Audio_Callback callback, void* user_data);
38 34
39 // Configures the current state to be playing or not. The caller is 35 // Configures the current state to be playing or not. The caller is
40 // responsible for ensuring the new state is the opposite of the current one. 36 // responsible for ensuring the new state is the opposite of the current one.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Callback to call when audio is ready to accept new samples. 77 // Callback to call when audio is ready to accept new samples.
82 PPB_Audio_Callback callback_; 78 PPB_Audio_Callback callback_;
83 79
84 // User data pointer passed verbatim to the callback function. 80 // User data pointer passed verbatim to the callback function.
85 void* user_data_; 81 void* user_data_;
86 }; 82 };
87 83
88 } // namespace ppapi 84 } // namespace ppapi
89 85
90 #endif // PPAPI_SHARED_IMPL_AUDIO_IMPL_H_ 86 #endif // PPAPI_SHARED_IMPL_AUDIO_IMPL_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_resource.h ('k') | ppapi/shared_impl/audio_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698