| OLD | NEW |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { | 77 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { |
| 78 plugin_message_loop_->PostTask(FROM_HERE, base::Bind( | 78 plugin_message_loop_->PostTask(FROM_HERE, base::Bind( |
| 79 &PepperViewProxy::SetConnectionState, this, 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 { | |
| 88 // This method returns a value, so must run synchronously, so must be | |
| 89 // called only on the pepper thread. | |
| 90 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | |
| 91 | |
| 92 if (view_) | |
| 93 return view_->GetHorizontalScaleRatio(); | |
| 94 return 1.0; | |
| 95 } | |
| 96 | |
| 97 double PepperViewProxy::GetVerticalScaleRatio() const { | |
| 98 // This method returns a value, so must run synchronously, so must be | |
| 99 // called only on the pepper thread. | |
| 100 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | |
| 101 | |
| 102 if (view_) | |
| 103 return view_->GetVerticalScaleRatio(); | |
| 104 return 1.0; | |
| 105 } | |
| 106 | |
| 107 void PepperViewProxy::AllocateFrame( | 87 void PepperViewProxy::AllocateFrame( |
| 108 media::VideoFrame::Format format, | 88 media::VideoFrame::Format format, |
| 109 const SkISize& size, | 89 const SkISize& size, |
| 110 scoped_refptr<media::VideoFrame>* frame_out, | 90 scoped_refptr<media::VideoFrame>* frame_out, |
| 111 const base::Closure& done) { | 91 const base::Closure& done) { |
| 112 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { | 92 if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { |
| 113 plugin_message_loop_->PostTask(FROM_HERE, base::Bind( | 93 plugin_message_loop_->PostTask(FROM_HERE, base::Bind( |
| 114 &PepperViewProxy::AllocateFrame, this, format, size, frame_out, done)); | 94 &PepperViewProxy::AllocateFrame, this, format, size, frame_out, done)); |
| 115 return; | 95 return; |
| 116 } | 96 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 145 view_->OnPartialFrameOutput(frame, rects, done); | 125 view_->OnPartialFrameOutput(frame, rects, done); |
| 146 } | 126 } |
| 147 | 127 |
| 148 void PepperViewProxy::Detach() { | 128 void PepperViewProxy::Detach() { |
| 149 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | 129 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); |
| 150 instance_ = NULL; | 130 instance_ = NULL; |
| 151 view_ = NULL; | 131 view_ = NULL; |
| 152 } | 132 } |
| 153 | 133 |
| 154 } // namespace remoting | 134 } // namespace remoting |
| OLD | NEW |