cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / cpp / private / video_source_private.cc
blob264c001103c021d7011c0f211306c657ef607190
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ppapi/cpp/private/video_source_private.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_video_source_private.h"
9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/private/video_frame_private.h"
13 #include "ppapi/cpp/var.h"
15 namespace pp {
17 namespace {
19 template <> const char* interface_name<PPB_VideoSource_Private_0_1>() {
20 return PPB_VIDEOSOURCE_PRIVATE_INTERFACE_0_1;
23 } // namespace
25 VideoSource_Private::VideoSource_Private() {
28 VideoSource_Private::VideoSource_Private(const InstanceHandle& instance) {
29 if (!has_interface<PPB_VideoSource_Private_0_1>())
30 return;
31 PassRefFromConstructor(get_interface<PPB_VideoSource_Private_0_1>()->Create(
32 instance.pp_instance()));
35 VideoSource_Private::VideoSource_Private(const VideoSource_Private& other)
36 : Resource(other) {
39 VideoSource_Private::VideoSource_Private(PassRef, PP_Resource resource)
40 : Resource(PASS_REF, resource) {
43 int32_t VideoSource_Private::Open(const Var& stream_url,
44 const CompletionCallback& cc) {
45 if (has_interface<PPB_VideoSource_Private_0_1>()) {
46 int32_t result =
47 get_interface<PPB_VideoSource_Private_0_1>()->Open(
48 pp_resource(),
49 stream_url.pp_var(), cc.pp_completion_callback());
50 return result;
52 return cc.MayForce(PP_ERROR_NOINTERFACE);
55 int32_t VideoSource_Private::GetFrame(
56 const CompletionCallbackWithOutput<VideoFrame_Private>& cc) {
57 if (has_interface<PPB_VideoSource_Private_0_1>()) {
58 return get_interface<PPB_VideoSource_Private_0_1>()->GetFrame(
59 pp_resource(),
60 cc.output(), cc.pp_completion_callback());
62 return cc.MayForce(PP_ERROR_NOINTERFACE);
65 void VideoSource_Private::Close() {
66 if (has_interface<PPB_VideoSource_Private_0_1>()) {
67 get_interface<PPB_VideoSource_Private_0_1>()->Close(pp_resource());
71 } // namespace pp