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

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

Issue 4971003: Inject MessageLoop into Capturer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 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
« remoting/host/capturer_mac.h ('K') | « remoting/host/mock_objects.h ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This is an application of a minimal host process in a Chromoting 5 // This is an application of a minimal host process in a Chromoting
6 // system. It serves the purpose of gluing different pieces together 6 // system. It serves the purpose of gluing different pieces together
7 // to make a functional host process for testing. 7 // to make a functional host process for testing.
8 // 8 //
9 // It peforms the following functionality: 9 // It peforms the following functionality:
10 // 1. Connect to the GTalk network and register the machine as a host. 10 // 1. Connect to the GTalk network and register the machine as a host.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::AtExitManager exit_manager; 73 base::AtExitManager exit_manager;
74 base::EnsureNSPRInit(); 74 base::EnsureNSPRInit();
75 75
76 // Allocate a chromoting context and starts it. 76 // Allocate a chromoting context and starts it.
77 remoting::ChromotingHostContext context; 77 remoting::ChromotingHostContext context;
78 context.Start(); 78 context.Start();
79 79
80 scoped_ptr<remoting::Capturer> capturer; 80 scoped_ptr<remoting::Capturer> capturer;
81 scoped_ptr<remoting::protocol::InputStub> input_stub; 81 scoped_ptr<remoting::protocol::InputStub> input_stub;
82 #if defined(OS_WIN) 82 #if defined(OS_WIN)
83 capturer.reset(new remoting::CapturerGdi()); 83 capturer.reset(new remoting::CapturerGdi(
84 context.capture_message_loop()));
84 input_stub.reset(new remoting::EventExecutorWin( 85 input_stub.reset(new remoting::EventExecutorWin(
85 context.capture_message_loop(), capturer.get())); 86 context.capture_message_loop(), capturer.get()));
86 #elif defined(OS_LINUX) 87 #elif defined(OS_LINUX)
87 capturer.reset(new remoting::CapturerLinux()); 88 capturer.reset(new remoting::CapturerLinux(
89 context.capture_message_loop()));
88 input_stub.reset(new remoting::EventExecutorLinux( 90 input_stub.reset(new remoting::EventExecutorLinux(
89 context.capture_message_loop(), capturer.get())); 91 context.capture_message_loop(), capturer.get()));
90 #elif defined(OS_MACOSX) 92 #elif defined(OS_MACOSX)
91 capturer.reset(new remoting::CapturerMac()); 93 capturer.reset(new remoting::CapturerMac(
94 context.capture_message_loop()));
92 input_stub.reset(new remoting::EventExecutorMac( 95 input_stub.reset(new remoting::EventExecutorMac(
93 context.capture_message_loop(), capturer.get())); 96 context.capture_message_loop(), capturer.get()));
94 #endif 97 #endif
95 98
96 // Check the argument to see if we should use a fake capturer. 99 // Check the argument to see if we should use a fake capturer.
97 bool fake = cmd_line->HasSwitch(kFakeSwitchName); 100 bool fake = cmd_line->HasSwitch(kFakeSwitchName);
98 101
99 #if defined(OS_WIN) 102 #if defined(OS_WIN)
100 std::wstring home_path = GetEnvironmentVar(kHomeDrive); 103 std::wstring home_path = GetEnvironmentVar(kHomeDrive);
101 home_path += GetEnvironmentVar(kHomePath); 104 home_path += GetEnvironmentVar(kHomePath);
102 #else 105 #else
103 std::string home_path = GetEnvironmentVar(base::env_vars::kHome); 106 std::string home_path = GetEnvironmentVar(base::env_vars::kHome);
104 #endif 107 #endif
105 FilePath config_path(home_path); 108 FilePath config_path(home_path);
106 config_path = config_path.Append(kDefaultConfigPath); 109 config_path = config_path.Append(kDefaultConfigPath);
107 if (cmd_line->HasSwitch(kConfigSwitchName)) { 110 if (cmd_line->HasSwitch(kConfigSwitchName)) {
108 config_path = cmd_line->GetSwitchValuePath(kConfigSwitchName); 111 config_path = cmd_line->GetSwitchValuePath(kConfigSwitchName);
109 } 112 }
110 113
111 if (fake) { 114 if (fake) {
112 // Inject a fake capturer. 115 // Inject a fake capturer.
113 LOG(INFO) << "Using a fake capturer."; 116 LOG(INFO) << "Using a fake capturer.";
114 capturer.reset(new remoting::CapturerFake()); 117 capturer.reset(new remoting::CapturerFake(context.capture_message_loop()));
115 } 118 }
116 119
117 base::Thread file_io_thread("FileIO"); 120 base::Thread file_io_thread("FileIO");
118 file_io_thread.Start(); 121 file_io_thread.Start();
119 122
120 scoped_refptr<remoting::JsonHostConfig> config( 123 scoped_refptr<remoting::JsonHostConfig> config(
121 new remoting::JsonHostConfig( 124 new remoting::JsonHostConfig(
122 config_path, file_io_thread.message_loop_proxy())); 125 config_path, file_io_thread.message_loop_proxy()));
123 126
124 if (!config->Read()) { 127 if (!config->Read()) {
(...skipping 17 matching lines...) Expand all
142 // Let the chromoting host run until the shutdown task is executed. 145 // Let the chromoting host run until the shutdown task is executed.
143 MessageLoop message_loop(MessageLoop::TYPE_UI); 146 MessageLoop message_loop(MessageLoop::TYPE_UI);
144 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); 147 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop));
145 message_loop.Run(); 148 message_loop.Run();
146 149
147 // And then stop the chromoting context. 150 // And then stop the chromoting context.
148 context.Stop(); 151 context.Stop();
149 file_io_thread.Stop(); 152 file_io_thread.Stop();
150 return 0; 153 return 0;
151 } 154 }
OLDNEW
« remoting/host/capturer_mac.h ('K') | « remoting/host/mock_objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698