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

Side by Side Diff: remoting/host/continue_window.cc

Issue 2911893003: Deprecate NonThreadSafe in remoting in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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/host/client_session.cc ('k') | remoting/host/continue_window_linux.cc » ('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/host/continue_window.h" 5 #include "remoting/host/continue_window.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "remoting/host/client_session_control.h" 8 #include "remoting/host/client_session_control.h"
9 9
10 // Minutes before the local user should confirm that the session should go on. 10 // Minutes before the local user should confirm that the session should go on.
11 const int kSessionExpirationTimeoutMinutes = 10; 11 const int kSessionExpirationTimeoutMinutes = 10;
12 12
13 // Minutes before the session will be disconnected (from the moment the Continue 13 // Minutes before the session will be disconnected (from the moment the Continue
14 // window has been shown). 14 // window has been shown).
15 const int kSessionDisconnectTimeoutMinutes = 1; 15 const int kSessionDisconnectTimeoutMinutes = 1;
16 16
17 namespace remoting { 17 namespace remoting {
18 18
19 ContinueWindow::~ContinueWindow() { 19 ContinueWindow::~ContinueWindow() {
20 } 20 }
21 21
22 void ContinueWindow::Start( 22 void ContinueWindow::Start(
23 const base::WeakPtr<ClientSessionControl>& client_session_control) { 23 const base::WeakPtr<ClientSessionControl>& client_session_control) {
24 DCHECK(CalledOnValidThread()); 24 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
25 DCHECK(!client_session_control_.get()); 25 DCHECK(!client_session_control_.get());
26 DCHECK(client_session_control.get()); 26 DCHECK(client_session_control.get());
27 27
28 client_session_control_ = client_session_control; 28 client_session_control_ = client_session_control;
29 29
30 session_expired_timer_.Start( 30 session_expired_timer_.Start(
31 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes), 31 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
32 this, &ContinueWindow::OnSessionExpired); 32 this, &ContinueWindow::OnSessionExpired);
33 } 33 }
34 34
35 void ContinueWindow::ContinueSession() { 35 void ContinueWindow::ContinueSession() {
36 DCHECK(CalledOnValidThread()); 36 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
37 37
38 disconnect_timer_.Stop(); 38 disconnect_timer_.Stop();
39 39
40 if (!client_session_control_.get()) 40 if (!client_session_control_.get())
41 return; 41 return;
42 42
43 // Hide the Continue window and resume the session. 43 // Hide the Continue window and resume the session.
44 HideUi(); 44 HideUi();
45 client_session_control_->SetDisableInputs(false); 45 client_session_control_->SetDisableInputs(false);
46 46
47 session_expired_timer_.Start( 47 session_expired_timer_.Start(
48 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes), 48 FROM_HERE, base::TimeDelta::FromMinutes(kSessionExpirationTimeoutMinutes),
49 this, &ContinueWindow::OnSessionExpired); 49 this, &ContinueWindow::OnSessionExpired);
50 } 50 }
51 51
52 void ContinueWindow::DisconnectSession() { 52 void ContinueWindow::DisconnectSession() {
53 DCHECK(CalledOnValidThread()); 53 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
54 54
55 disconnect_timer_.Stop(); 55 disconnect_timer_.Stop();
56 if (client_session_control_.get()) 56 if (client_session_control_.get())
57 client_session_control_->DisconnectSession(protocol::MAX_SESSION_LENGTH); 57 client_session_control_->DisconnectSession(protocol::MAX_SESSION_LENGTH);
58 } 58 }
59 59
60 ContinueWindow::ContinueWindow() {} 60 ContinueWindow::ContinueWindow() {}
61 61
62 void ContinueWindow::OnSessionExpired() { 62 void ContinueWindow::OnSessionExpired() {
63 DCHECK(CalledOnValidThread()); 63 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
64 64
65 if (!client_session_control_.get()) 65 if (!client_session_control_.get())
66 return; 66 return;
67 67
68 // Stop the remote input while the Continue window is shown. 68 // Stop the remote input while the Continue window is shown.
69 client_session_control_->SetDisableInputs(true); 69 client_session_control_->SetDisableInputs(true);
70 70
71 // Show the Continue window and wait for the local user input. 71 // Show the Continue window and wait for the local user input.
72 ShowUi(); 72 ShowUi();
73 disconnect_timer_.Start( 73 disconnect_timer_.Start(
74 FROM_HERE, base::TimeDelta::FromMinutes(kSessionDisconnectTimeoutMinutes), 74 FROM_HERE, base::TimeDelta::FromMinutes(kSessionDisconnectTimeoutMinutes),
75 this, &ContinueWindow::DisconnectSession); 75 this, &ContinueWindow::DisconnectSession);
76 } 76 }
77 77
78 } // namespace remoting 78 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/continue_window_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698