diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 20:46:43 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 20:46:43 +0000 |
commit | 1d099ec2852d678472338dd3997e899b179f0ac4 (patch) | |
tree | 6e16f3dbdf0efc175858e15338120f08f2428250 /ppapi/cpp | |
parent | 6e0309cc54da8227ab6e9c2bea19ac27d2a817b2 (diff) | |
download | chromium_src-1d099ec2852d678472338dd3997e899b179f0ac4.zip chromium_src-1d099ec2852d678472338dd3997e899b179f0ac4.tar.gz chromium_src-1d099ec2852d678472338dd3997e899b179f0ac4.tar.bz2 |
Check for specific PPB versions in pp::Fullscreen, pp::Audio and pp::Graphics3D implementations.
BUG=107398
Review URL: http://codereview.chromium.org/9682003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/audio.cc | 19 | ||||
-rw-r--r-- | ppapi/cpp/fullscreen.cc | 18 | ||||
-rw-r--r-- | ppapi/cpp/graphics_3d.cc | 29 |
3 files changed, 32 insertions, 34 deletions
diff --git a/ppapi/cpp/audio.cc b/ppapi/cpp/audio.cc index fc7c55a..89702be 100644 --- a/ppapi/cpp/audio.cc +++ b/ppapi/cpp/audio.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,8 +11,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_Audio>() { - return PPB_AUDIO_INTERFACE; +template <> const char* interface_name<PPB_Audio_1_0>() { + return PPB_AUDIO_INTERFACE_1_0; } } // namespace @@ -22,21 +22,20 @@ Audio::Audio(const InstanceHandle& instance, PPB_Audio_Callback callback, void* user_data) : config_(config) { - if (has_interface<PPB_Audio>()) { - PassRefFromConstructor(get_interface<PPB_Audio>()->Create( + if (has_interface<PPB_Audio_1_0>()) { + PassRefFromConstructor(get_interface<PPB_Audio_1_0>()->Create( instance.pp_instance(), config.pp_resource(), callback, user_data)); } } bool Audio::StartPlayback() { - return has_interface<PPB_Audio>() && - get_interface<PPB_Audio>()->StartPlayback(pp_resource()); + return has_interface<PPB_Audio_1_0>() && + get_interface<PPB_Audio_1_0>()->StartPlayback(pp_resource()); } bool Audio::StopPlayback() { - return has_interface<PPB_Audio>() && - get_interface<PPB_Audio>()->StopPlayback(pp_resource()); + return has_interface<PPB_Audio_1_0>() && + get_interface<PPB_Audio_1_0>()->StopPlayback(pp_resource()); } } // namespace pp - diff --git a/ppapi/cpp/fullscreen.cc b/ppapi/cpp/fullscreen.cc index 26b6e77a..c5ad4f0 100644 --- a/ppapi/cpp/fullscreen.cc +++ b/ppapi/cpp/fullscreen.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,8 +14,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_Fullscreen>() { - return PPB_FULLSCREEN_INTERFACE; +template <> const char* interface_name<PPB_Fullscreen_1_0>() { + return PPB_FULLSCREEN_INTERFACE_1_0; } } // namespace @@ -28,22 +28,22 @@ Fullscreen::~Fullscreen() { } bool Fullscreen::IsFullscreen() { - return has_interface<PPB_Fullscreen>() && - get_interface<PPB_Fullscreen>()->IsFullscreen( + return has_interface<PPB_Fullscreen_1_0>() && + get_interface<PPB_Fullscreen_1_0>()->IsFullscreen( instance_.pp_instance()); } bool Fullscreen::SetFullscreen(bool fullscreen) { - if (!has_interface<PPB_Fullscreen>()) + if (!has_interface<PPB_Fullscreen_1_0>()) return false; - return PP_ToBool(get_interface<PPB_Fullscreen>()->SetFullscreen( + return PP_ToBool(get_interface<PPB_Fullscreen_1_0>()->SetFullscreen( instance_.pp_instance(), PP_FromBool(fullscreen))); } bool Fullscreen::GetScreenSize(Size* size) { - if (!has_interface<PPB_Fullscreen>()) + if (!has_interface<PPB_Fullscreen_1_0>()) return false; - return PP_ToBool(get_interface<PPB_Fullscreen>()->GetScreenSize( + return PP_ToBool(get_interface<PPB_Fullscreen_1_0>()->GetScreenSize( instance_.pp_instance(), &size->pp_size())); } diff --git a/ppapi/cpp/graphics_3d.cc b/ppapi/cpp/graphics_3d.cc index 32578de..be11bec 100644 --- a/ppapi/cpp/graphics_3d.cc +++ b/ppapi/cpp/graphics_3d.cc @@ -14,8 +14,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_Graphics3D>() { - return PPB_GRAPHICS_3D_INTERFACE; +template <> const char* interface_name<PPB_Graphics3D_1_0>() { + return PPB_GRAPHICS_3D_INTERFACE_1_0; } } // namespace @@ -25,8 +25,8 @@ Graphics3D::Graphics3D() { Graphics3D::Graphics3D(const InstanceHandle& instance, const int32_t attrib_list[]) { - if (has_interface<PPB_Graphics3D>()) { - PassRefFromConstructor(get_interface<PPB_Graphics3D>()->Create( + if (has_interface<PPB_Graphics3D_1_0>()) { + PassRefFromConstructor(get_interface<PPB_Graphics3D_1_0>()->Create( instance.pp_instance(), 0, attrib_list)); } } @@ -34,8 +34,8 @@ Graphics3D::Graphics3D(const InstanceHandle& instance, Graphics3D::Graphics3D(const InstanceHandle& instance, const Graphics3D& share_context, const int32_t attrib_list[]) { - if (has_interface<PPB_Graphics3D>()) { - PassRefFromConstructor(get_interface<PPB_Graphics3D>()->Create( + if (has_interface<PPB_Graphics3D_1_0>()) { + PassRefFromConstructor(get_interface<PPB_Graphics3D_1_0>()->Create( instance.pp_instance(), share_context.pp_resource(), attrib_list)); @@ -46,39 +46,38 @@ Graphics3D::~Graphics3D() { } int32_t Graphics3D::GetAttribs(int32_t attrib_list[]) const { - if (!has_interface<PPB_Graphics3D>()) + if (!has_interface<PPB_Graphics3D_1_0>()) return PP_ERROR_NOINTERFACE; - return get_interface<PPB_Graphics3D>()->GetAttribs( + return get_interface<PPB_Graphics3D_1_0>()->GetAttribs( pp_resource(), attrib_list); } int32_t Graphics3D::SetAttribs(const int32_t attrib_list[]) { - if (!has_interface<PPB_Graphics3D>()) + if (!has_interface<PPB_Graphics3D_1_0>()) return PP_ERROR_NOINTERFACE; - return get_interface<PPB_Graphics3D>()->SetAttribs( + return get_interface<PPB_Graphics3D_1_0>()->SetAttribs( pp_resource(), attrib_list); } int32_t Graphics3D::ResizeBuffers(int32_t width, int32_t height) { - if (!has_interface<PPB_Graphics3D>()) + if (!has_interface<PPB_Graphics3D_1_0>()) return PP_ERROR_NOINTERFACE; - return get_interface<PPB_Graphics3D>()->ResizeBuffers( + return get_interface<PPB_Graphics3D_1_0>()->ResizeBuffers( pp_resource(), width, height); } int32_t Graphics3D::SwapBuffers(const CompletionCallback& cc) { - if (!has_interface<PPB_Graphics3D>()) + if (!has_interface<PPB_Graphics3D_1_0>()) return PP_ERROR_NOINTERFACE; - return get_interface<PPB_Graphics3D>()->SwapBuffers( + return get_interface<PPB_Graphics3D_1_0>()->SwapBuffers( pp_resource(), cc.pp_completion_callback()); } } // namespace pp - |