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

Side by Side Diff: webkit/plugins/ppapi/audio_helper.h

Issue 9015013: Convert callers to use the new TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Foo Created 8 years, 11 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 | « no previous file | webkit/plugins/ppapi/audio_helper.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 WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
6 #define WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ 6 #define WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "base/sync_socket.h" 11 #include "base/sync_socket.h"
12 #include "ppapi/c/pp_completion_callback.h" 12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/shared_impl/resource.h" 13 #include "ppapi/shared_impl/resource.h"
14 #include "ppapi/shared_impl/scoped_pp_resource.h" 14 #include "ppapi/shared_impl/scoped_pp_resource.h"
15 #include "ppapi/shared_impl/tracked_callback.h"
15 #include "webkit/plugins/ppapi/plugin_delegate.h" 16 #include "webkit/plugins/ppapi/plugin_delegate.h"
16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
17 18
18 namespace webkit { 19 namespace webkit {
19 namespace ppapi { 20 namespace ppapi {
20 21
21 class AudioHelper : public PluginDelegate::PlatformAudioCommonClient { 22 class AudioHelper : public PluginDelegate::PlatformAudioCommonClient {
22 public: 23 public:
23 AudioHelper(); 24 AudioHelper();
24 virtual ~AudioHelper(); 25 virtual ~AudioHelper();
25 26
26 // |PluginDelegate::PlatformAudioCommonClient| implementation. 27 // |PluginDelegate::PlatformAudioCommonClient| implementation.
27 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, 28 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
28 size_t shared_memory_size_, 29 size_t shared_memory_size_,
29 base::SyncSocket::Handle socket) OVERRIDE; 30 base::SyncSocket::Handle socket) OVERRIDE;
30 31
31 void SetCallbackInfo(bool create_callback_pending, 32 void SetCreateCallback(
32 PP_CompletionCallback create_callback); 33 scoped_refptr< ::ppapi::TrackedCallback> create_callback);
33 34
34 protected: 35 protected:
35 // TODO(viettrungluu): This is all very poorly thought out. Refactor. 36 // TODO(viettrungluu): This is all very poorly thought out. Refactor.
36 37
37 // To be called by implementations of |PPB_Audio_API|/|PPB_AudioInput_API|. 38 // To be called by implementations of |PPB_Audio_API|/|PPB_AudioInput_API|.
38 int32_t GetSyncSocketImpl(int* sync_socket); 39 int32_t GetSyncSocketImpl(int* sync_socket);
39 int32_t GetSharedMemoryImpl(int* shm_handle, uint32_t* shm_size); 40 int32_t GetSharedMemoryImpl(int* shm_handle, uint32_t* shm_size);
40 41
41 // To be implemented by subclasses to call their |SetStreamInfo()|. 42 // To be implemented by subclasses to call their |SetStreamInfo()|.
42 virtual void OnSetStreamInfo(base::SharedMemoryHandle shared_memory_handle, 43 virtual void OnSetStreamInfo(base::SharedMemoryHandle shared_memory_handle,
43 size_t shared_memory_size, 44 size_t shared_memory_size,
44 base::SyncSocket::Handle socket_handle) = 0; 45 base::SyncSocket::Handle socket_handle) = 0;
45 46
46 private: 47 private:
47 // Is a create callback pending to fire? 48 scoped_refptr< ::ppapi::TrackedCallback> create_callback_;
48 bool create_callback_pending_;
49
50 // Trusted callback invoked from StreamCreated.
51 PP_CompletionCallback create_callback_;
52 49
53 // When a create callback is being issued, these will save the info for 50 // When a create callback is being issued, these will save the info for
54 // querying from the callback. The proxy uses this to get the handles to the 51 // querying from the callback. The proxy uses this to get the handles to the
55 // other process instead of mapping them in the renderer. These will be 52 // other process instead of mapping them in the renderer. These will be
56 // invalid all other times. 53 // invalid all other times.
57 scoped_ptr<base::SharedMemory> shared_memory_for_create_callback_; 54 scoped_ptr<base::SharedMemory> shared_memory_for_create_callback_;
58 size_t shared_memory_size_for_create_callback_; 55 size_t shared_memory_size_for_create_callback_;
59 scoped_ptr<base::SyncSocket> socket_for_create_callback_; 56 scoped_ptr<base::SyncSocket> socket_for_create_callback_;
60 57
61 DISALLOW_COPY_AND_ASSIGN(AudioHelper); 58 DISALLOW_COPY_AND_ASSIGN(AudioHelper);
62 }; 59 };
63 60
64 } // namespace ppapi 61 } // namespace ppapi
65 } // namespace webkit 62 } // namespace webkit
66 63
67 #endif // WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_ 64 #endif // WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/audio_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698