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

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

Issue 8344025: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/ppapi_proxy_test.cc ('k') | ppapi/proxy/ppb_core_proxy.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 #include "ppapi/proxy/ppb_audio_proxy.h" 5 #include "ppapi/proxy/ppb_audio_proxy.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/threading/simple_thread.h" 8 #include "base/threading/simple_thread.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_audio.h" 10 #include "ppapi/c/ppb_audio.h"
11 #include "ppapi/c/ppb_audio_config.h" 11 #include "ppapi/c/ppb_audio_config.h"
12 #include "ppapi/c/ppb_var.h" 12 #include "ppapi/c/ppb_var.h"
13 #include "ppapi/c/trusted/ppb_audio_trusted.h" 13 #include "ppapi/c/trusted/ppb_audio_trusted.h"
14 #include "ppapi/proxy/enter_proxy.h" 14 #include "ppapi/proxy/enter_proxy.h"
15 #include "ppapi/proxy/interface_id.h" 15 #include "ppapi/proxy/interface_id.h"
16 #include "ppapi/proxy/plugin_dispatcher.h" 16 #include "ppapi/proxy/plugin_dispatcher.h"
17 #include "ppapi/proxy/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/shared_impl/audio_impl.h" 18 #include "ppapi/shared_impl/audio_impl.h"
19 #include "ppapi/shared_impl/ppapi_globals.h"
19 #include "ppapi/shared_impl/resource.h" 20 #include "ppapi/shared_impl/resource.h"
20 #include "ppapi/thunk/ppb_audio_config_api.h" 21 #include "ppapi/thunk/ppb_audio_config_api.h"
21 #include "ppapi/thunk/enter.h" 22 #include "ppapi/thunk/enter.h"
22 #include "ppapi/thunk/resource_creation_api.h" 23 #include "ppapi/thunk/resource_creation_api.h"
23 #include "ppapi/thunk/thunk.h" 24 #include "ppapi/thunk/thunk.h"
24 25
25 using ppapi::thunk::EnterResourceNoLock; 26 using ppapi::thunk::EnterResourceNoLock;
26 using ppapi::thunk::PPB_Audio_API; 27 using ppapi::thunk::PPB_Audio_API;
27 using ppapi::thunk::PPB_AudioConfig_API; 28 using ppapi::thunk::PPB_AudioConfig_API;
28 29
(...skipping 28 matching lines...) Expand all
57 DISALLOW_COPY_AND_ASSIGN(Audio); 58 DISALLOW_COPY_AND_ASSIGN(Audio);
58 }; 59 };
59 60
60 Audio::Audio(const HostResource& audio_id, 61 Audio::Audio(const HostResource& audio_id,
61 PP_Resource config_id, 62 PP_Resource config_id,
62 PPB_Audio_Callback callback, 63 PPB_Audio_Callback callback,
63 void* user_data) 64 void* user_data)
64 : Resource(audio_id), 65 : Resource(audio_id),
65 config_(config_id) { 66 config_(config_id) {
66 SetCallback(callback, user_data); 67 SetCallback(callback, user_data);
67 PluginResourceTracker::GetInstance()->AddRefResource(config_); 68 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_);
68 } 69 }
69 70
70 Audio::~Audio() { 71 Audio::~Audio() {
71 PluginResourceTracker::GetInstance()->ReleaseResource(config_); 72 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(config_);
72 } 73 }
73 74
74 PPB_Audio_API* Audio::AsPPB_Audio_API() { 75 PPB_Audio_API* Audio::AsPPB_Audio_API() {
75 return this; 76 return this;
76 } 77 }
77 78
78 PP_Resource Audio::GetCurrentConfig() { 79 PP_Resource Audio::GetCurrentConfig() {
79 // AddRef for the caller. 80 // AddRef for the caller.
80 PluginResourceTracker::GetInstance()->AddRefResource(config_); 81 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_);
81 return config_; 82 return config_;
82 } 83 }
83 84
84 PP_Bool Audio::StartPlayback() { 85 PP_Bool Audio::StartPlayback() {
85 if (playing()) 86 if (playing())
86 return PP_TRUE; 87 return PP_TRUE;
87 SetStartPlaybackState(); 88 SetStartPlaybackState();
88 PluginDispatcher::GetForResource(this)->Send( 89 PluginDispatcher::GetForResource(this)->Send(
89 new PpapiHostMsg_PPBAudio_StartOrStop( 90 new PpapiHostMsg_PPBAudio_StartOrStop(
90 INTERFACE_ID_PPB_AUDIO, host_resource(), true)); 91 INTERFACE_ID_PPB_AUDIO, host_resource(), true));
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 320 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
320 IntToPlatformFile(shared_memory_handle), false); 321 IntToPlatformFile(shared_memory_handle), false);
321 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 322 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
322 return PP_ERROR_FAILED; 323 return PP_ERROR_FAILED;
323 324
324 return PP_OK; 325 return PP_OK;
325 } 326 }
326 327
327 } // namespace proxy 328 } // namespace proxy
328 } // namespace ppapi 329 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | ppapi/proxy/ppb_core_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698