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

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

Issue 19297003: Add support for drawing video onto a Java ByteBuffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reword highly cryptic comment Created 7 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 | Annotate | Revision Log
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "remoting/client/audio_player.h" 9 #include "remoting/client/audio_player.h"
10 #include "remoting/client/jni/chromoting_jni.h" 10 #include "remoting/client/jni/chromoting_jni.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return; 43 return;
44 } 44 }
45 45
46 username_ = ""; 46 username_ = "";
47 auth_token_ = ""; 47 auth_token_ = "";
48 host_jid_ = ""; 48 host_jid_ = "";
49 host_id_ = ""; 49 host_id_ = "";
50 host_pubkey_ = ""; 50 host_pubkey_ = "";
51 51
52 // |client_| must be torn down before |signaling_|. 52 // |client_| must be torn down before |signaling_|.
53 pin_callback_.Reset();
54 client_.reset(); 53 client_.reset();
55 connection_.reset();
56 client_context_.reset();
57 client_config_.reset();
58 signaling_.reset();
59 signaling_config_.reset();
60 network_settings_.reset();
61 } 54 }
62 55
63 void ChromotingJniInstance::ProvideSecret(const char* pin) { 56 void ChromotingJniInstance::ProvideSecret(const char* pin) {
64 DCHECK(ChromotingJni::GetInstance()-> 57 DCHECK(ChromotingJni::GetInstance()->
65 ui_task_runner()->BelongsToCurrentThread()); 58 ui_task_runner()->BelongsToCurrentThread());
66 DCHECK(!pin_callback_.is_null()); 59 DCHECK(!pin_callback_.is_null());
67 60
68 // We invoke the string constructor to ensure |pin| gets copied *before* the 61 // We invoke the string constructor to ensure |pin| gets copied *before* the
69 // asynchronous run, since Java might want it back as soon as we return. 62 // asynchronous run, since Java might want it back as soon as we return.
70 ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE, 63 ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE,
71 base::Bind(pin_callback_, pin)); 64 base::Bind(pin_callback_, pin));
72 } 65 }
73 66
67 void ChromotingJniInstance::RedrawGraphics() {
68 if (!ChromotingJni::GetInstance()->
69 display_task_runner()->BelongsToCurrentThread()) {
70 ChromotingJni::GetInstance()->display_task_runner()->PostTask(
71 FROM_HERE,
72 base::Bind(&ChromotingJniInstance::RedrawGraphics,
73 this));
74 return;
75 }
76
77 ChromotingJni::GetInstance()->RedrawCanvas();
78 }
79
74 void ChromotingJniInstance::OnConnectionState( 80 void ChromotingJniInstance::OnConnectionState(
75 protocol::ConnectionToHost::State state, 81 protocol::ConnectionToHost::State state,
76 protocol::ErrorCode error) { 82 protocol::ErrorCode error) {
77 if (!ChromotingJni::GetInstance()-> 83 if (!ChromotingJni::GetInstance()->
78 ui_task_runner()->BelongsToCurrentThread()) { 84 ui_task_runner()->BelongsToCurrentThread()) {
79 ChromotingJni::GetInstance()-> 85 ChromotingJni::GetInstance()->
80 ui_task_runner()->PostTask( 86 ui_task_runner()->PostTask(
81 FROM_HERE, 87 FROM_HERE,
82 base::Bind(&ChromotingJniInstance::OnConnectionState, 88 base::Bind(&ChromotingJniInstance::OnConnectionState,
83 this, 89 this,
(...skipping 29 matching lines...) Expand all
113 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> 119 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>
114 ChromotingJniInstance::GetTokenFetcher(const std::string& host_public_key) { 120 ChromotingJniInstance::GetTokenFetcher(const std::string& host_public_key) {
115 // Return null to indicate that third-party authentication is unsupported. 121 // Return null to indicate that third-party authentication is unsupported.
116 return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>(); 122 return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>();
117 } 123 }
118 124
119 void ChromotingJniInstance::ConnectToHostOnDisplayThread() { 125 void ChromotingJniInstance::ConnectToHostOnDisplayThread() {
120 DCHECK(ChromotingJni::GetInstance()-> 126 DCHECK(ChromotingJni::GetInstance()->
121 display_task_runner()->BelongsToCurrentThread()); 127 display_task_runner()->BelongsToCurrentThread());
122 128
123 if (!frame_consumer_.get()) { 129 frame_consumer_ = new FrameConsumerProxy(
124 frame_consumer_ = new FrameConsumerProxy( 130 ChromotingJni::GetInstance()->display_task_runner());
125 ChromotingJni::GetInstance()->display_task_runner()); 131 view_.reset(new FrameConsumerImpl());
126 // TODO(solb) Instantiate some FrameConsumer implementation and attach it. 132 frame_consumer_->Attach(view_->AsWeakPtr());
Wez 2013/07/16 02:18:12 Rather than have JniFrameConsumer SupportsWeakPtr,
solb 2013/07/16 18:00:57 Done.
127 }
128 133
129 ChromotingJni::GetInstance()->network_task_runner()->PostTask( 134 ChromotingJni::GetInstance()->network_task_runner()->PostTask(
130 FROM_HERE, 135 FROM_HERE,
131 base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread, 136 base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread,
132 this)); 137 this));
133 } 138 }
134 139
135 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { 140 void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
136 DCHECK(ChromotingJni::GetInstance()-> 141 DCHECK(ChromotingJni::GetInstance()->
137 network_task_runner()->BelongsToCurrentThread()); 142 network_task_runner()->BelongsToCurrentThread());
(...skipping 19 matching lines...) Expand all
157 162
158 connection_.reset(new protocol::ConnectionToHost(true)); 163 connection_.reset(new protocol::ConnectionToHost(true));
159 164
160 client_.reset(new ChromotingClient(*client_config_, 165 client_.reset(new ChromotingClient(*client_config_,
161 client_context_.get(), 166 client_context_.get(),
162 connection_.get(), 167 connection_.get(),
163 this, 168 this,
164 frame_consumer_, 169 frame_consumer_,
165 scoped_ptr<AudioPlayer>())); 170 scoped_ptr<AudioPlayer>()));
166 171
172 view_->set_frame_producer(client_->GetFrameProducer());
173
167 signaling_config_.reset(new XmppSignalStrategy::XmppServerConfig()); 174 signaling_config_.reset(new XmppSignalStrategy::XmppServerConfig());
168 signaling_config_->host = CHAT_SERVER; 175 signaling_config_->host = CHAT_SERVER;
169 signaling_config_->port = CHAT_PORT; 176 signaling_config_->port = CHAT_PORT;
170 signaling_config_->use_tls = CHAT_USE_TLS; 177 signaling_config_->use_tls = CHAT_USE_TLS;
171 178
172 signaling_.reset(new XmppSignalStrategy( 179 signaling_.reset(new XmppSignalStrategy(
173 ChromotingJni::GetInstance()->url_requester(), 180 ChromotingJni::GetInstance()->url_requester(),
174 username_, 181 username_,
175 auth_token_, 182 auth_token_,
176 CHAT_AUTH_METHOD, 183 CHAT_AUTH_METHOD,
(...skipping 21 matching lines...) Expand all
198 pairable, 205 pairable,
199 callback)); 206 callback));
200 return; 207 return;
201 } 208 }
202 209
203 pin_callback_ = callback; 210 pin_callback_ = callback;
204 ChromotingJni::GetInstance()->DisplayAuthenticationPrompt(); 211 ChromotingJni::GetInstance()->DisplayAuthenticationPrompt();
205 } 212 }
206 213
207 } // namespace remoting 214 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698