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

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

Issue 6359010: Add PepperViewProxy to protect PepperView and ChromotingInstance on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done 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/chromoting_instance.cc
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index b11dae7af6acf65b6e04c3f6f4b6967876bfd32a..e7af6c028a315b5a27ccb78f18c1f7e54e49e9ca 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -20,6 +20,7 @@
#include "remoting/client/plugin/chromoting_scriptable_object.h"
#include "remoting/client/plugin/pepper_input_handler.h"
#include "remoting/client/plugin/pepper_view.h"
+#include "remoting/client/plugin/pepper_view_proxy.h"
#include "remoting/jingle_glue/jingle_thread.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/jingle_connection_to_host.h"
@@ -38,11 +39,11 @@ ChromotingInstance::~ChromotingInstance() {
client_->Stop();
}
- // TODO(ajwong): We need to ensure all objects have actually stopped posting
- // to the message loop before this point. Right now, we don't have a well
- // defined stop for the plugin process, and the thread shutdown is likely a
- // race condition.
+ // Stopping the context shutdown all chromoting threads. This is a requirement
+ // before we can call Detach() on |view_proxy_|.
context_.Stop();
+
+ view_proxy_->Detach();
}
bool ChromotingInstance::Init(uint32_t argc,
@@ -70,11 +71,13 @@ bool ChromotingInstance::Init(uint32_t argc,
host_connection_.reset(new protocol::JingleConnectionToHost(
context_.jingle_thread()));
view_.reset(new PepperView(this, &context_));
+ view_proxy_ = new PepperViewProxy(this, view_.get());
rectangle_decoder_.reset(
- new RectangleUpdateDecoder(context_.decode_message_loop(), view_.get()));
+ new RectangleUpdateDecoder(context_.decode_message_loop(),
+ view_proxy_));
input_handler_.reset(new PepperInputHandler(&context_,
host_connection_.get(),
- view_.get()));
+ view_proxy_));
// Default to a medium grey.
view_->SetSolidFill(0xFFCDCDCD);
@@ -88,7 +91,7 @@ void ChromotingInstance::Connect(const ClientConfig& config) {
client_.reset(new ChromotingClient(config,
&context_,
host_connection_.get(),
- view_.get(),
+ view_proxy_,
rectangle_decoder_.get(),
input_handler_.get(),
NULL));

Powered by Google App Engine
This is Rietveld 408576698