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

Unified Diff: remoting/client/plugin/pepper_view_proxy.cc

Issue 6359010: Add PepperViewProxy to protect PepperView and ChromotingInstance on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unrelated files Created 9 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/plugin/pepper_view_proxy.cc
diff --git a/remoting/client/plugin/pepper_view_proxy.cc b/remoting/client/plugin/pepper_view_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e64651181ad12a970f39fff58c299fe87aeffa49
--- /dev/null
+++ b/remoting/client/plugin/pepper_view_proxy.cc
@@ -0,0 +1,147 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
Sergey Ulanov 2011/01/25 21:29:37 2011
Alpha Left Google 2011/01/25 22:20:47 Done.
+// 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

Powered by Google App Engine
This is Rietveld 408576698