summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/input_handler.h1
-rw-r--r--remoting/client/plugin/chromoting_instance.cc1
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.cc17
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.h2
-rw-r--r--remoting/client/plugin/pepper_input_handler.h1
-rw-r--r--remoting/client/plugin/pepper_util.cc14
-rw-r--r--remoting/client/plugin/pepper_util.h18
-rw-r--r--remoting/client/plugin/pepper_view.cc12
-rw-r--r--remoting/client/plugin/pepper_view.h4
-rw-r--r--remoting/client/rectangle_update_decoder.h2
10 files changed, 32 insertions, 40 deletions
diff --git a/remoting/client/input_handler.h b/remoting/client/input_handler.h
index 34265f6..e6082a2 100644
--- a/remoting/client/input_handler.h
+++ b/remoting/client/input_handler.h
@@ -8,7 +8,6 @@
#include <set>
#include "base/basictypes.h"
-#include "base/task.h"
#include "remoting/proto/event.pb.h"
namespace remoting {
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index a65a2a0..e6dea0e 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -14,7 +14,6 @@
#include "base/stringprintf.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
-#include "base/task.h"
#include "base/threading/thread.h"
#include "media/base/media.h"
#include "ppapi/cpp/completion_callback.h"
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index a9a60d5..218c3c9 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -4,6 +4,7 @@
#include "remoting/client/plugin/chromoting_scriptable_object.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop_proxy.h"
// TODO(wez): Remove this when crbug.com/86353 is complete.
@@ -44,8 +45,7 @@ const char kRoundTripLatencyAttribute[] = "roundTripLatency";
ChromotingScriptableObject::ChromotingScriptableObject(
ChromotingInstance* instance, base::MessageLoopProxy* plugin_message_loop)
: instance_(instance),
- plugin_message_loop_(plugin_message_loop),
- ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
+ plugin_message_loop_(plugin_message_loop) {
}
ChromotingScriptableObject::~ChromotingScriptableObject() {
@@ -283,8 +283,8 @@ void ChromotingScriptableObject::AttachXmppProxy(PepperXmppProxy* xmpp_proxy) {
void ChromotingScriptableObject::SendIq(const std::string& message_xml) {
plugin_message_loop_->PostTask(
- FROM_HERE, task_factory_.NewRunnableMethod(
- &ChromotingScriptableObject::DoSendIq, message_xml));
+ FROM_HERE, base::Bind(
+ &ChromotingScriptableObject::DoSendIq, AsWeakPtr(), message_xml));
}
void ChromotingScriptableObject::AddAttribute(const std::string& name,
@@ -302,15 +302,16 @@ void ChromotingScriptableObject::AddMethod(const std::string& name,
void ChromotingScriptableObject::SignalConnectionInfoChange(int status,
int error) {
plugin_message_loop_->PostTask(
- FROM_HERE, task_factory_.NewRunnableMethod(
+ FROM_HERE, base::Bind(
&ChromotingScriptableObject::DoSignalConnectionInfoChange,
- status, error));
+ AsWeakPtr(), status, error));
}
void ChromotingScriptableObject::SignalDesktopSizeChange() {
plugin_message_loop_->PostTask(
- FROM_HERE, task_factory_.NewRunnableMethod(
- &ChromotingScriptableObject::DoSignalDesktopSizeChange));
+ FROM_HERE, base::Bind(
+ &ChromotingScriptableObject::DoSignalDesktopSizeChange,
+ AsWeakPtr()));
}
void ChromotingScriptableObject::DoSignalConnectionInfoChange(int status,
diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h
index 547b349..ece9003 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.h
+++ b/remoting/client/plugin/chromoting_scriptable_object.h
@@ -102,7 +102,6 @@
#include <string>
#include <vector>
-#include "base/task.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/cpp/dev/scriptable_object_deprecated.h"
#include "ppapi/cpp/var.h"
@@ -235,7 +234,6 @@ class ChromotingScriptableObject
ChromotingInstance* instance_;
scoped_refptr<base::MessageLoopProxy> plugin_message_loop_;
- ScopedRunnableMethodFactory<ChromotingScriptableObject> task_factory_;
DISALLOW_COPY_AND_ASSIGN(ChromotingScriptableObject);
};
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h
index bc7f2be..759e5f2 100644
--- a/remoting/client/plugin/pepper_input_handler.h
+++ b/remoting/client/plugin/pepper_input_handler.h
@@ -5,6 +5,7 @@
#ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
#define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
+#include "base/compiler_specific.h"
#include "remoting/client/input_handler.h"
namespace pp {
diff --git a/remoting/client/plugin/pepper_util.cc b/remoting/client/plugin/pepper_util.cc
index 2a726d2..013bba4 100644
--- a/remoting/client/plugin/pepper_util.cc
+++ b/remoting/client/plugin/pepper_util.cc
@@ -4,20 +4,16 @@
#include "remoting/client/plugin/pepper_util.h"
-#include "base/task.h"
+#include "base/callback.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/cpp/module.h"
namespace remoting {
-void CompletionCallbackTaskAdapter(void* user_data, int32_t not_used) {
- Task* task = reinterpret_cast<Task*>(user_data);
- task->Run();
- delete task;
-}
-
-pp::CompletionCallback TaskToCompletionCallback(Task* task) {
- return pp::CompletionCallback(&CompletionCallbackTaskAdapter, task);
+void CompletionCallbackClosureAdapter(void* user_data, int32_t not_used) {
+ base::Closure* closure = reinterpret_cast<base::Closure*>(user_data);
+ closure->Run();
+ delete closure;
}
} // namespace remoting
diff --git a/remoting/client/plugin/pepper_util.h b/remoting/client/plugin/pepper_util.h
index 9de64bc..90dbeb3 100644
--- a/remoting/client/plugin/pepper_util.h
+++ b/remoting/client/plugin/pepper_util.h
@@ -6,22 +6,18 @@
#define REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "ppapi/cpp/completion_callback.h"
-class Task;
-
namespace remoting {
-// Function for adapting a Chromium style Task into a
-// PP_CompletionCallback friendly function. The Task object should be passed
-// as |user_data|. This function will invoke Task::Run() on |user_data| when
-// called, and then delete |user_data|.
-void CompletionCallbackTaskAdapter(void* user_data, int32_t not_used);
-
-// Converts a Task* to a pp::CompletionCallback suitable for use with ppapi C++
-// APIs that require a pp::CompletionCallback. Takes ownership of |task|.
-pp::CompletionCallback TaskToCompletionCallback(Task* task);
+// Function for adapting a Chromium base::Closure to a PP_CompletionCallback
+// friendly function. The base::Closure object should be a dynamically
+// allocated copy of the result from base::Bind(). It should be passed as
+// |user_data|. This function will invoke base::Closure::Run() on
+// |user_data| when called, and then delete |user_data|.
+void CompletionCallbackClosureAdapter(void* user_data, int32_t not_used);
} // namespace remoting
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc
index 04f8f98..ec29290 100644
--- a/remoting/client/plugin/pepper_view.cc
+++ b/remoting/client/plugin/pepper_view.cc
@@ -48,7 +48,7 @@ PepperView::PepperView(ChromotingInstance* instance, ClientContext* context)
flush_blocked_(false),
is_static_fill_(false),
static_fill_color_(0),
- ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
PepperView::~PepperView() {
@@ -61,7 +61,7 @@ bool PepperView::Initialize() {
void PepperView::TearDown() {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());
- task_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
}
void PepperView::Paint() {
@@ -178,8 +178,10 @@ void PepperView::BlankRect(pp::ImageData& image_data, const pp::Rect& rect) {
}
void PepperView::FlushGraphics(base::Time paint_start) {
- scoped_ptr<Task> task(
- task_factory_.NewRunnableMethod(&PepperView::OnPaintDone, paint_start));
+ scoped_ptr<base::Closure> task(
+ new base::Closure(
+ base::Bind(&PepperView::OnPaintDone, weak_factory_.GetWeakPtr(),
+ paint_start)));
// Flag needs to be set here in order to get a proper error code for Flush().
// Otherwise Flush() will always return PP_OK_COMPLETIONPENDING and the error
@@ -188,7 +190,7 @@ void PepperView::FlushGraphics(base::Time paint_start) {
// Note that we can also handle this by providing an actual callback which
// takes the result code. Right now everything goes to the task that doesn't
// result value.
- pp::CompletionCallback pp_callback(&CompletionCallbackTaskAdapter,
+ pp::CompletionCallback pp_callback(&CompletionCallbackClosureAdapter,
task.get(),
PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
int error = graphics2d_.Flush(pp_callback);
diff --git a/remoting/client/plugin/pepper_view.h b/remoting/client/plugin/pepper_view.h
index 9036650..a64ae7f 100644
--- a/remoting/client/plugin/pepper_view.h
+++ b/remoting/client/plugin/pepper_view.h
@@ -13,7 +13,7 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
-#include "base/task.h"
+#include "base/memory/weak_ptr.h"
#include "media/base/video_frame.h"
#include "ppapi/cpp/graphics_2d.h"
#include "ppapi/cpp/point.h"
@@ -103,7 +103,7 @@ class PepperView : public ChromotingView,
bool is_static_fill_;
uint32 static_fill_color_;
- ScopedRunnableMethodFactory<PepperView> task_factory_;
+ base::WeakPtrFactory<PepperView> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PepperView);
};
diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h
index fd5b2c2..cdbfa05 100644
--- a/remoting/client/rectangle_update_decoder.h
+++ b/remoting/client/rectangle_update_decoder.h
@@ -5,8 +5,8 @@
#ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_
#define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_
+#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
-#include "base/task.h"
#include "media/base/video_frame.h"
#include "remoting/base/decoder.h"