1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
// Copyright (c) 2011 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.
#include "remoting/client/plugin/pepper_view_proxy.h"
#include "base/message_loop.h"
#include "remoting/base/tracer.h"
#include "remoting/client/client_context.h"
#include "remoting/client/plugin/chromoting_instance.h"
#include "remoting/client/plugin/pepper_util.h"
namespace remoting {
PepperViewProxy::PepperViewProxy(ChromotingInstance* instance, PepperView* view)
: instance_(instance),
view_(view) {
}
PepperViewProxy::~PepperViewProxy() {
}
bool PepperViewProxy::Initialize() {
// This method needs a return value so we can't post a task and process on
// another thread so just return true since PepperView doesn't do anything
// either.
return true;
}
void PepperViewProxy::TearDown() {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(NewTracedMethod(this, &PepperViewProxy::TearDown));
return;
}
if (view_)
view_->TearDown();
}
void PepperViewProxy::Paint() {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(NewTracedMethod(this, &PepperViewProxy::Paint));
return;
}
if (view_)
view_->Paint();
}
void PepperViewProxy::SetSolidFill(uint32 color) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewTracedMethod(this, &PepperViewProxy::SetSolidFill, color));
return;
}
if (view_)
view_->SetSolidFill(color);
}
void PepperViewProxy::UnsetSolidFill() {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewTracedMethod(this, &PepperViewProxy::UnsetSolidFill));
return;
}
if (view_)
view_->UnsetSolidFill();
}
void PepperViewProxy::SetConnectionState(ConnectionState state) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewRunnableMethod(this, &PepperViewProxy::SetConnectionState, state));
return;
}
if (view_)
view_->SetConnectionState(state);
}
void PepperViewProxy::SetViewport(int x, int y, int width, int height) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(NewTracedMethod(this, &PepperViewProxy::SetViewport,
x, y, width, height));
return;
}
if (view_)
view_->SetViewport(x, y, width, height);
}
void PepperViewProxy::AllocateFrame(
media::VideoFrame::Format format,
size_t width,
size_t height,
base::TimeDelta timestamp,
base::TimeDelta duration,
scoped_refptr<media::VideoFrame>* frame_out,
Task* done) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewTracedMethod(this, &PepperViewProxy::AllocateFrame, format, width,
height, timestamp, duration, frame_out, done));
return;
}
if (view_) {
view_->AllocateFrame(format, width, height, timestamp, duration, frame_out,
done);
}
}
void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewTracedMethod(this, &PepperViewProxy::ReleaseFrame,
make_scoped_refptr(frame)));
return;
}
if (view_)
view_->ReleaseFrame(frame);
}
void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame,
UpdatedRects* rects,
Task* done) {
if (instance_ && !instance_->CurrentlyOnPluginThread()) {
RunTaskOnPluginThread(
NewTracedMethod(this, &PepperViewProxy::OnPartialFrameOutput,
make_scoped_refptr(frame), rects, done));
return;
}
if (view_)
view_->OnPartialFrameOutput(frame, rects, done);
}
void PepperViewProxy::Detach() {
DCHECK(instance_->CurrentlyOnPluginThread());
instance_ = NULL;
view_ = NULL;
}
} // namespace remoting
|