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

Side by Side Diff: remoting/client/plugin/pepper_view_proxy.cc

Issue 8493020: Move code in src/remoting to the new callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: - Created 9 years, 1 month 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
« no previous file with comments | « remoting/client/plugin/pepper_view_proxy.h ('k') | remoting/client/rectangle_update_decoder.h » ('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 "remoting/client/plugin/pepper_view_proxy.h" 5 #include "remoting/client/plugin/pepper_view_proxy.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "remoting/client/client_context.h" 8 #include "remoting/client/client_context.h"
9 #include "remoting/client/plugin/chromoting_instance.h" 9 #include "remoting/client/plugin/chromoting_instance.h"
10 10
(...skipping 12 matching lines...) Expand all
23 bool PepperViewProxy::Initialize() { 23 bool PepperViewProxy::Initialize() {
24 // This method needs a return value so we can't post a task and process on 24 // This method needs a return value so we can't post a task and process on
25 // another thread so just return true since PepperView doesn't do anything 25 // another thread so just return true since PepperView doesn't do anything
26 // either. 26 // either.
27 return true; 27 return true;
28 } 28 }
29 29
30 void PepperViewProxy::TearDown() { 30 void PepperViewProxy::TearDown() {
31 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 31 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
32 plugin_message_loop_->PostTask( 32 plugin_message_loop_->PostTask(
33 FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::TearDown)); 33 FROM_HERE, base::Bind(&PepperViewProxy::TearDown, this));
34 return; 34 return;
35 } 35 }
36 36
37 if (view_) 37 if (view_)
38 view_->TearDown(); 38 view_->TearDown();
39 } 39 }
40 40
41 void PepperViewProxy::Paint() { 41 void PepperViewProxy::Paint() {
42 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 42 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
43 plugin_message_loop_->PostTask( 43 plugin_message_loop_->PostTask(
44 FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::Paint)); 44 FROM_HERE, base::Bind(&PepperViewProxy::Paint, this));
45 return; 45 return;
46 } 46 }
47 47
48 if (view_) 48 if (view_)
49 view_->Paint(); 49 view_->Paint();
50 } 50 }
51 51
52 void PepperViewProxy::SetSolidFill(uint32 color) { 52 void PepperViewProxy::SetSolidFill(uint32 color) {
53 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 53 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
54 plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 54 plugin_message_loop_->PostTask(FROM_HERE, base::Bind(
55 this, &PepperViewProxy::SetSolidFill, color)); 55 &PepperViewProxy::SetSolidFill, this, color));
56 return; 56 return;
57 } 57 }
58 58
59 if (view_) 59 if (view_)
60 view_->SetSolidFill(color); 60 view_->SetSolidFill(color);
61 } 61 }
62 62
63 void PepperViewProxy::UnsetSolidFill() { 63 void PepperViewProxy::UnsetSolidFill() {
64 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 64 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
65 plugin_message_loop_->PostTask( 65 plugin_message_loop_->PostTask(
66 FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::UnsetSolidFill)); 66 FROM_HERE, base::Bind(&PepperViewProxy::UnsetSolidFill, this));
67 return; 67 return;
68 } 68 }
69 69
70 if (view_) 70 if (view_)
71 view_->UnsetSolidFill(); 71 view_->UnsetSolidFill();
72 } 72 }
73 73
74 void PepperViewProxy::SetConnectionState( 74 void PepperViewProxy::SetConnectionState(
75 protocol::ConnectionToHost::State state, 75 protocol::ConnectionToHost::State state,
76 protocol::ConnectionToHost::Error error) { 76 protocol::ConnectionToHost::Error error) {
77 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 77 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
78 plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 78 plugin_message_loop_->PostTask(FROM_HERE, base::Bind(
79 this, &PepperViewProxy::SetConnectionState, state, error)); 79 &PepperViewProxy::SetConnectionState, this, state, error));
80 return; 80 return;
81 } 81 }
82 82
83 if (view_) 83 if (view_)
84 view_->SetConnectionState(state, error); 84 view_->SetConnectionState(state, error);
85 } 85 }
86 86
87 double PepperViewProxy::GetHorizontalScaleRatio() const { 87 double PepperViewProxy::GetHorizontalScaleRatio() const {
88 // This method returns a value, so must run synchronously, so must be 88 // This method returns a value, so must run synchronously, so must be
89 // called only on the pepper thread. 89 // called only on the pepper thread.
90 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 90 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
91 91
92 if (view_) 92 if (view_)
93 return view_->GetHorizontalScaleRatio(); 93 return view_->GetHorizontalScaleRatio();
94 return 1.0; 94 return 1.0;
95 } 95 }
96 96
97 double PepperViewProxy::GetVerticalScaleRatio() const { 97 double PepperViewProxy::GetVerticalScaleRatio() const {
98 // This method returns a value, so must run synchronously, so must be 98 // This method returns a value, so must run synchronously, so must be
99 // called only on the pepper thread. 99 // called only on the pepper thread.
100 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 100 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
101 101
102 if (view_) 102 if (view_)
103 return view_->GetVerticalScaleRatio(); 103 return view_->GetVerticalScaleRatio();
104 return 1.0; 104 return 1.0;
105 } 105 }
106 106
107 void PepperViewProxy::AllocateFrame( 107 void PepperViewProxy::AllocateFrame(
108 media::VideoFrame::Format format, 108 media::VideoFrame::Format format,
109 size_t width, 109 const SkISize& size,
110 size_t height,
111 base::TimeDelta timestamp,
112 base::TimeDelta duration,
113 scoped_refptr<media::VideoFrame>* frame_out, 110 scoped_refptr<media::VideoFrame>* frame_out,
114 Task* done) { 111 const base::Closure& done) {
115 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 112 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
116 plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 113 plugin_message_loop_->PostTask(FROM_HERE, base::Bind(
117 this, &PepperViewProxy::AllocateFrame, format, width, 114 &PepperViewProxy::AllocateFrame, this, format, size, frame_out, done));
118 height, timestamp, duration, frame_out, done));
119 return; 115 return;
120 } 116 }
121 117
122 if (view_) { 118 if (view_) {
123 view_->AllocateFrame(format, width, height, timestamp, duration, frame_out, 119 view_->AllocateFrame(format, size, frame_out, done);
124 done);
125 } 120 }
126 } 121 }
127 122
128 void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) { 123 void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) {
129 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 124 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
130 plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 125 plugin_message_loop_->PostTask(FROM_HERE, base::Bind(
131 this, &PepperViewProxy::ReleaseFrame, make_scoped_refptr(frame))); 126 &PepperViewProxy::ReleaseFrame, this, make_scoped_refptr(frame)));
132 return; 127 return;
133 } 128 }
134 129
135 if (view_) 130 if (view_)
136 view_->ReleaseFrame(frame); 131 view_->ReleaseFrame(frame);
137 } 132 }
138 133
139 void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame, 134 void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame,
140 RectVector* rects, 135 RectVector* rects,
141 Task* done) { 136 const base::Closure& done) {
142 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { 137 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
143 plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( 138 plugin_message_loop_->PostTask(FROM_HERE, base::Bind(
144 this, &PepperViewProxy::OnPartialFrameOutput, 139 &PepperViewProxy::OnPartialFrameOutput, this,
145 make_scoped_refptr(frame), rects, done)); 140 make_scoped_refptr(frame), rects, done));
146 return; 141 return;
147 } 142 }
148 143
149 if (view_) 144 if (view_)
150 view_->OnPartialFrameOutput(frame, rects, done); 145 view_->OnPartialFrameOutput(frame, rects, done);
151 } 146 }
152 147
153 void PepperViewProxy::Detach() { 148 void PepperViewProxy::Detach() {
154 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 149 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
155 instance_ = NULL; 150 instance_ = NULL;
156 view_ = NULL; 151 view_ = NULL;
157 } 152 }
158 153
159 } // namespace remoting 154 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_view_proxy.h ('k') | remoting/client/rectangle_update_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698