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

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

Issue 6489031: Run event executor on the ui thread to remove the need to explicitly XFlush() the XTest calls. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unused headers. Created 9 years, 10 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
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/remoting.gyp » ('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) 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 18 matching lines...) Expand all
29 #include "base/threading/thread.h" 29 #include "base/threading/thread.h"
30 #include "media/base/media.h" 30 #include "media/base/media.h"
31 #include "remoting/base/tracer.h" 31 #include "remoting/base/tracer.h"
32 #include "remoting/host/capturer_fake.h" 32 #include "remoting/host/capturer_fake.h"
33 #include "remoting/host/chromoting_host.h" 33 #include "remoting/host/chromoting_host.h"
34 #include "remoting/host/chromoting_host_context.h" 34 #include "remoting/host/chromoting_host_context.h"
35 #include "remoting/host/event_executor.h" 35 #include "remoting/host/event_executor.h"
36 #include "remoting/host/json_host_config.h" 36 #include "remoting/host/json_host_config.h"
37 #include "remoting/proto/video.pb.h" 37 #include "remoting/proto/video.pb.h"
38 38
39 #if defined(TOOLKIT_USES_GTK)
40 #include "ui/gfx/gtk_util.h"
41 #endif
42
39 using remoting::ChromotingHost; 43 using remoting::ChromotingHost;
40 using remoting::protocol::CandidateSessionConfig; 44 using remoting::protocol::CandidateSessionConfig;
41 using remoting::protocol::ChannelConfig; 45 using remoting::protocol::ChannelConfig;
42 using std::string; 46 using std::string;
43 using std::wstring; 47 using std::wstring;
44 48
45 #if defined(OS_WIN) 49 #if defined(OS_WIN)
46 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json"; 50 const wchar_t kDefaultConfigPath[] = L".ChromotingConfig.json";
47 const wchar_t kHomeDrive[] = L"HOMEDRIVE"; 51 const wchar_t kHomeDrive[] = L"HOMEDRIVE";
48 const wchar_t kHomePath[] = L"HOMEPATH"; 52 const wchar_t kHomePath[] = L"HOMEPATH";
(...skipping 22 matching lines...) Expand all
71 // Needed for the Mac, so we don't leak objects when threads are created. 75 // Needed for the Mac, so we don't leak objects when threads are created.
72 base::mac::ScopedNSAutoreleasePool pool; 76 base::mac::ScopedNSAutoreleasePool pool;
73 77
74 CommandLine::Init(argc, argv); 78 CommandLine::Init(argc, argv);
75 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 79 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
76 80
77 base::AtExitManager exit_manager; 81 base::AtExitManager exit_manager;
78 base::EnsureNSPRInit(); 82 base::EnsureNSPRInit();
79 83
80 // Allocate a chromoting context and starts it. 84 // Allocate a chromoting context and starts it.
81 remoting::ChromotingHostContext context; 85 gfx::GtkInitFromCommandLine(*cmd_line);
86 MessageLoopForUI message_loop;
87 remoting::ChromotingHostContext context(&message_loop);
82 context.Start(); 88 context.Start();
83 89
84 90
85 #if defined(OS_WIN) 91 #if defined(OS_WIN)
86 wstring home_path = GetEnvironmentVar(kHomeDrive); 92 wstring home_path = GetEnvironmentVar(kHomeDrive);
87 home_path += GetEnvironmentVar(kHomePath); 93 home_path += GetEnvironmentVar(kHomePath);
88 #else 94 #else
89 string home_path = GetEnvironmentVar(base::env_vars::kHome); 95 string home_path = GetEnvironmentVar(base::env_vars::kHome);
90 #endif 96 #endif
91 FilePath config_path(home_path); 97 FilePath config_path(home_path);
(...skipping 21 matching lines...) Expand all
113 << "Cannot load media library"; 119 << "Cannot load media library";
114 120
115 // Construct a chromoting host. 121 // Construct a chromoting host.
116 scoped_refptr<ChromotingHost> host; 122 scoped_refptr<ChromotingHost> host;
117 123
118 bool fake = cmd_line->HasSwitch(kFakeSwitchName); 124 bool fake = cmd_line->HasSwitch(kFakeSwitchName);
119 if (fake) { 125 if (fake) {
120 remoting::Capturer* capturer = 126 remoting::Capturer* capturer =
121 new remoting::CapturerFake(context.main_message_loop()); 127 new remoting::CapturerFake(context.main_message_loop());
122 remoting::protocol::InputStub* input_stub = 128 remoting::protocol::InputStub* input_stub =
123 CreateEventExecutor(context.main_message_loop(), capturer); 129 CreateEventExecutor(context.ui_message_loop(), capturer);
124 host = ChromotingHost::Create( 130 host = ChromotingHost::Create(
125 &context, config, capturer, input_stub); 131 &context, config, capturer, input_stub);
126 } else { 132 } else {
127 host = ChromotingHost::Create(&context, config); 133 host = ChromotingHost::Create(&context, config);
128 } 134 }
129 135
130 if (cmd_line->HasSwitch(kVideoSwitchName)) { 136 if (cmd_line->HasSwitch(kVideoSwitchName)) {
131 string video_codec = cmd_line->GetSwitchValueASCII(kVideoSwitchName); 137 string video_codec = cmd_line->GetSwitchValueASCII(kVideoSwitchName);
132 scoped_ptr<CandidateSessionConfig> config( 138 scoped_ptr<CandidateSessionConfig> config(
133 CandidateSessionConfig::CreateDefault()); 139 CandidateSessionConfig::CreateDefault());
(...skipping 14 matching lines...) Expand all
148 LOG(ERROR) << "Unknown video codec: " << video_codec; 154 LOG(ERROR) << "Unknown video codec: " << video_codec;
149 context.Stop(); 155 context.Stop();
150 return 1; 156 return 1;
151 } 157 }
152 config->mutable_video_configs()->push_back(ChannelConfig( 158 config->mutable_video_configs()->push_back(ChannelConfig(
153 transport, remoting::protocol::kDefaultStreamVersion, codec)); 159 transport, remoting::protocol::kDefaultStreamVersion, codec));
154 host->set_protocol_config(config.release()); 160 host->set_protocol_config(config.release());
155 } 161 }
156 162
157 // Let the chromoting host run until the shutdown task is executed. 163 // Let the chromoting host run until the shutdown task is executed.
158 MessageLoop message_loop(MessageLoop::TYPE_UI);
159 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); 164 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop));
160 message_loop.Run(); 165 message_loop.MessageLoop::Run();
161 166
162 // And then stop the chromoting context. 167 // And then stop the chromoting context.
163 context.Stop(); 168 context.Stop();
164 file_io_thread.Stop(); 169 file_io_thread.Stop();
165 return 0; 170 return 0;
166 } 171 }
OLDNEW
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698