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

Side by Side Diff: ppapi/proxy/ppb_audio_config_proxy.cc

Issue 7621070: Merge the plugin and impl side of the audio config and input event resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile issues 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
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 #include "ppapi/proxy/ppb_audio_config_proxy.h" 5 #include "ppapi/proxy/ppb_audio_config_proxy.h"
6 6
7 #include "ppapi/c/ppb_audio_config.h" 7 #include "ppapi/c/ppb_audio_config.h"
8 #include "ppapi/proxy/plugin_dispatcher.h" 8 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/shared_impl/audio_config_impl.h" 10 #include "ppapi/shared_impl/audio_config_impl.h"
11 #include "ppapi/thunk/thunk.h" 11 #include "ppapi/thunk/thunk.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 namespace proxy { 14 namespace proxy {
15 15
16 // The implementation is actually in AudioConfigImpl.
17 class AudioConfig : public Resource, public AudioConfigImpl {
18 public:
19 // Note that you must call Init (on AudioConfigImpl) before using this class.
20 AudioConfig(const HostResource& resource);
21 virtual ~AudioConfig();
22
23 // Resource overrides.
24 virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE;
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(AudioConfig);
28 };
29
30 AudioConfig::AudioConfig(const HostResource& resource) : Resource(resource) {
31 }
32
33 AudioConfig::~AudioConfig() {
34 }
35
36 thunk::PPB_AudioConfig_API* AudioConfig::AsPPB_AudioConfig_API() {
37 return this;
38 }
39
40 namespace { 16 namespace {
41 17
42 InterfaceProxy* CreateAudioConfigProxy(Dispatcher* dispatcher, 18 InterfaceProxy* CreateAudioConfigProxy(Dispatcher* dispatcher,
43 const void* target_interface) { 19 const void* target_interface) {
44 return new PPB_AudioConfig_Proxy(dispatcher, target_interface); 20 return new PPB_AudioConfig_Proxy(dispatcher, target_interface);
45 } 21 }
46 22
47 } // namespace 23 } // namespace
48 24
49 PPB_AudioConfig_Proxy::PPB_AudioConfig_Proxy(Dispatcher* dispatcher, 25 PPB_AudioConfig_Proxy::PPB_AudioConfig_Proxy(Dispatcher* dispatcher,
50 const void* target_interface) 26 const void* target_interface)
51 : InterfaceProxy(dispatcher, target_interface) { 27 : InterfaceProxy(dispatcher, target_interface) {
52 } 28 }
53 29
54 PPB_AudioConfig_Proxy::~PPB_AudioConfig_Proxy() { 30 PPB_AudioConfig_Proxy::~PPB_AudioConfig_Proxy() {
55 } 31 }
56 32
57 // static 33 // static
58 const InterfaceProxy::Info* PPB_AudioConfig_Proxy::GetInfo() { 34 const InterfaceProxy::Info* PPB_AudioConfig_Proxy::GetInfo() {
59 static const Info info = { 35 static const Info info = {
60 thunk::GetPPB_AudioConfig_Thunk(), 36 thunk::GetPPB_AudioConfig_Thunk(),
61 PPB_AUDIO_CONFIG_INTERFACE, 37 PPB_AUDIO_CONFIG_INTERFACE,
62 INTERFACE_ID_PPB_AUDIO_CONFIG, 38 INTERFACE_ID_PPB_AUDIO_CONFIG,
63 false, 39 false,
64 &CreateAudioConfigProxy, 40 &CreateAudioConfigProxy,
65 }; 41 };
66 return &info; 42 return &info;
67 } 43 }
68 44
69 // static
70 PP_Resource PPB_AudioConfig_Proxy::CreateProxyResource(
yzshen1 2011/08/22 17:37:00 You could also remove the declaration in the .h fi
71 PP_Instance instance,
72 PP_AudioSampleRate sample_rate,
73 uint32_t sample_frame_count) {
74 scoped_refptr<AudioConfig> object(new AudioConfig(
75 HostResource::MakeInstanceOnly(instance)));
76 if (!object->Init(sample_rate, sample_frame_count))
77 return 0;
78 return object->GetReference();
79 }
80
81 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { 45 bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) {
82 // There are no IPC messages for this interface. 46 // There are no IPC messages for this interface.
83 NOTREACHED(); 47 NOTREACHED();
84 return false; 48 return false;
85 } 49 }
86 50
87 } // namespace proxy 51 } // namespace proxy
88 } // namespace ppapi 52 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698