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

Side by Side Diff: remoting/host/desktop_process.h

Issue 11272036: Fixing threading issues in remoting::DesktopProcess. The UI thread is now owned by the caller of re… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 years, 1 month 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
« no previous file with comments | « no previous file | remoting/host/desktop_process.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef REMOTING_HOST_DESKTOP_PROCESS_H_ 5 #ifndef REMOTING_HOST_DESKTOP_PROCESS_H_
6 #define REMOTING_HOST_DESKTOP_PROCESS_H_ 6 #define REMOTING_HOST_DESKTOP_PROCESS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
14 15
15 namespace IPC { 16 namespace IPC {
16 class ChannelProxy; 17 class ChannelProxy;
17 } // namespace IPC 18 } // namespace IPC
18 19
19 namespace remoting { 20 namespace remoting {
20 21
22 class AutoThreadTaskRunner;
21 class DesktopSessionAgent; 23 class DesktopSessionAgent;
22 24
23 class DesktopProcess : public IPC::Listener { 25 class DesktopProcess : public IPC::Listener {
24 public: 26 public:
25 explicit DesktopProcess(const std::string& daemon_channel_name); 27 DesktopProcess(scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
28 const std::string& daemon_channel_name);
26 virtual ~DesktopProcess(); 29 virtual ~DesktopProcess();
27 30
28 // IPC::Listener implementation. 31 // IPC::Listener implementation.
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
30 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 33 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
31 virtual void OnChannelError() OVERRIDE; 34 virtual void OnChannelError() OVERRIDE;
32 35
33 // Runs the desktop process. 36 // Creates the desktop agent and required threads and IPC channels. Returns
34 int Run(); 37 // true on success.
38 bool Start();
35 39
36 private: 40 private:
37 // Crashes the process in response to a daemon's request. The daemon passes 41 // Crashes the process in response to a daemon's request. The daemon passes
38 // the location of the code that detected the fatal error resulted in this 42 // the location of the code that detected the fatal error resulted in this
39 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message. 43 // request. See the declaration of ChromotingDaemonDesktopMsg_Crash message.
40 void OnCrash(const std::string& function_name, 44 void OnCrash(const std::string& function_name,
41 const std::string& file_name, 45 const std::string& file_name,
42 const int& line_number); 46 const int& line_number);
43 47
48 // Task runner on which public methods of this class should be called.
49 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
50
44 // Name of the IPC channel connecting the desktop process with the daemon 51 // Name of the IPC channel connecting the desktop process with the daemon
45 // process. 52 // process.
46 std::string daemon_channel_name_; 53 std::string daemon_channel_name_;
47 54
48 // IPC channel connecting the desktop process with the daemon process. 55 // IPC channel connecting the desktop process with the daemon process.
49 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 56 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
50 57
51 // Provides screen/audio capturing and input injection services for 58 // Provides screen/audio capturing and input injection services for
52 // the network process. 59 // the network process.
53 scoped_ptr<DesktopSessionAgent> desktop_agent_; 60 scoped_ptr<DesktopSessionAgent> desktop_agent_;
54 61
55 DISALLOW_COPY_AND_ASSIGN(DesktopProcess); 62 DISALLOW_COPY_AND_ASSIGN(DesktopProcess);
56 }; 63 };
57 64
58 } // namespace remoting 65 } // namespace remoting
59 66
60 #endif // REMOTING_HOST_DESKTOP_PROCESS_H_ 67 #endif // REMOTING_HOST_DESKTOP_PROCESS_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/desktop_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698