cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / cpp / private / video_destination_private.cc
blob5233b5f09eea64de6f7470dd5e37820777828194
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_destination_private.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/private/ppb_video_destination_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_VideoDestination_Private_0_1>() {
20 return PPB_VIDEODESTINATION_PRIVATE_INTERFACE_0_1;
23 } // namespace
25 VideoDestination_Private::VideoDestination_Private() {
28 VideoDestination_Private::VideoDestination_Private(
29 const InstanceHandle& instance) {
30 if (!has_interface<PPB_VideoDestination_Private_0_1>())
31 return;
32 PassRefFromConstructor(
33 get_interface<PPB_VideoDestination_Private_0_1>()->Create(
34 instance.pp_instance()));
37 VideoDestination_Private::VideoDestination_Private(
38 const VideoDestination_Private& other)
39 : Resource(other) {
42 VideoDestination_Private::VideoDestination_Private(PassRef,
43 PP_Resource resource)
44 : Resource(PASS_REF, resource) {
47 int32_t VideoDestination_Private::Open(const Var& stream_url,
48 const CompletionCallback& cc) {
49 if (has_interface<PPB_VideoDestination_Private_0_1>()) {
50 int32_t result =
51 get_interface<PPB_VideoDestination_Private_0_1>()->Open(
52 pp_resource(),
53 stream_url.pp_var(),
54 cc.pp_completion_callback());
55 return result;
57 return cc.MayForce(PP_ERROR_NOINTERFACE);
60 int32_t VideoDestination_Private::PutFrame(
61 const VideoFrame_Private& frame) {
62 if (has_interface<PPB_VideoDestination_Private_0_1>()) {
63 return get_interface<PPB_VideoDestination_Private_0_1>()->PutFrame(
64 pp_resource(),
65 &frame.pp_video_frame());
67 return PP_ERROR_NOINTERFACE;
70 void VideoDestination_Private::Close() {
71 if (has_interface<PPB_VideoDestination_Private_0_1>()) {
72 get_interface<PPB_VideoDestination_Private_0_1>()->Close(pp_resource());
76 } // namespace pp