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

Side by Side Diff: remoting/client/jni/chromoting_jni_instance.cc

Issue 2142253002: [Remoting Android] Fix GetWeakPtr() calls on multiple threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/jni_client.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/jni/chromoting_jni_instance.h" 5 #include "remoting/client/jni/chromoting_jni_instance.h"
6 6
7 #include <android/log.h> 7 #include <android/log.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 : jni_runtime_(jni_runtime), 67 : jni_runtime_(jni_runtime),
68 jni_client_(jni_client), 68 jni_client_(jni_client),
69 secret_fetcher_(secret_fetcher), 69 secret_fetcher_(secret_fetcher),
70 host_jid_(host_jid), 70 host_jid_(host_jid),
71 flags_(flags), 71 flags_(flags),
72 cursor_shape_stub_(std::move(cursor_shape_stub)), 72 cursor_shape_stub_(std::move(cursor_shape_stub)),
73 video_renderer_(std::move(video_renderer)), 73 video_renderer_(std::move(video_renderer)),
74 capabilities_(capabilities), 74 capabilities_(capabilities),
75 weak_factory_(this) { 75 weak_factory_(this) {
76 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread()); 76 DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
77 weak_ptr_ = weak_factory_.GetWeakPtr();
77 78
78 // Initialize XMPP config. 79 // Initialize XMPP config.
79 xmpp_config_.host = kXmppServer; 80 xmpp_config_.host = kXmppServer;
80 xmpp_config_.port = kXmppPort; 81 xmpp_config_.port = kXmppPort;
81 xmpp_config_.use_tls = kXmppUseTls; 82 xmpp_config_.use_tls = kXmppUseTls;
82 xmpp_config_.username = username; 83 xmpp_config_.username = username;
83 xmpp_config_.auth_token = auth_token; 84 xmpp_config_.auth_token = auth_token;
84 85
85 client_auth_config_.host_id = host_id; 86 client_auth_config_.host_id = host_id;
86 client_auth_config_.pairing_client_id = pairing_id; 87 client_auth_config_.pairing_client_id = pairing_id;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 protocol::CursorShapeStub* ChromotingJniInstance::GetCursorShapeStub() { 363 protocol::CursorShapeStub* ChromotingJniInstance::GetCursorShapeStub() {
363 return cursor_shape_stub_.get(); 364 return cursor_shape_stub_.get();
364 } 365 }
365 366
366 void ChromotingJniInstance::InjectClipboardEvent( 367 void ChromotingJniInstance::InjectClipboardEvent(
367 const protocol::ClipboardEvent& event) { 368 const protocol::ClipboardEvent& event) {
368 NOTIMPLEMENTED(); 369 NOTIMPLEMENTED();
369 } 370 }
370 371
371 base::WeakPtr<ChromotingJniInstance> ChromotingJniInstance::GetWeakPtr() { 372 base::WeakPtr<ChromotingJniInstance> ChromotingJniInstance::GetWeakPtr() {
372 return weak_factory_.GetWeakPtr(); 373 return weak_ptr_;
373 } 374 }
374 375
375 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { 376 void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
376 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); 377 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread());
377 378
378 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); 379 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
379 380
380 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner())); 381 client_context_.reset(new ClientContext(jni_runtime_->network_task_runner()));
381 client_context_->Start(); 382 client_context_->Start();
382 383
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 video_renderer_.reset(); 497 video_renderer_.reset();
497 signaling_.reset(); 498 signaling_.reset();
498 perf_tracker_.reset(); 499 perf_tracker_.reset();
499 client_context_.reset(); 500 client_context_.reset();
500 cursor_shape_stub_.reset(); 501 cursor_shape_stub_.reset();
501 502
502 weak_factory_.InvalidateWeakPtrs(); 503 weak_factory_.InvalidateWeakPtrs();
503 } 504 }
504 505
505 } // namespace remoting 506 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/jni_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698