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

Side by Side Diff: components/view_manager/view_manager_app.cc

Issue 1305893006: view-manager: Fix some issues regarding running tests in x11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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 | « components/view_manager/public/cpp/lib/args.cc ('k') | mojo/tools/data/apptests » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/view_manager/view_manager_app.h" 5 #include "components/view_manager/view_manager_app.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/view_manager/client_connection.h" 9 #include "components/view_manager/client_connection.h"
10 #include "components/view_manager/connection_manager.h" 10 #include "components/view_manager/connection_manager.h"
11 #include "components/view_manager/gles2/gpu_impl.h" 11 #include "components/view_manager/gles2/gpu_impl.h"
12 #include "components/view_manager/public/cpp/args.h" 12 #include "components/view_manager/public/cpp/args.h"
13 #include "components/view_manager/surfaces/surfaces_scheduler.h" 13 #include "components/view_manager/surfaces/surfaces_scheduler.h"
14 #include "components/view_manager/view_tree_host_connection.h" 14 #include "components/view_manager/view_tree_host_connection.h"
15 #include "components/view_manager/view_tree_host_impl.h" 15 #include "components/view_manager/view_tree_host_impl.h"
16 #include "components/view_manager/view_tree_impl.h" 16 #include "components/view_manager/view_tree_impl.h"
17 #include "mojo/application/public/cpp/application_connection.h" 17 #include "mojo/application/public/cpp/application_connection.h"
18 #include "mojo/application/public/cpp/application_impl.h" 18 #include "mojo/application/public/cpp/application_impl.h"
19 #include "mojo/application/public/cpp/application_runner.h" 19 #include "mojo/application/public/cpp/application_runner.h"
20 #include "mojo/common/tracing_impl.h" 20 #include "mojo/common/tracing_impl.h"
21 #include "third_party/mojo/src/mojo/public/c/system/main.h" 21 #include "third_party/mojo/src/mojo/public/c/system/main.h"
22 #include "ui/events/event_switches.h" 22 #include "ui/events/event_switches.h"
23 #include "ui/events/platform/platform_event_source.h" 23 #include "ui/events/platform/platform_event_source.h"
24 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
25 #include "ui/gl/test/gl_surface_test_support.h" 25 #include "ui/gl/test/gl_surface_test_support.h"
26 26
27 #if defined(USE_X11)
28 #include <X11/Xlib.h>
29 #include "ui/platform_window/x11/x11_window.h"
30 #endif
31
27 using mojo::ApplicationConnection; 32 using mojo::ApplicationConnection;
28 using mojo::ApplicationImpl; 33 using mojo::ApplicationImpl;
29 using mojo::Gpu; 34 using mojo::Gpu;
30 using mojo::InterfaceRequest; 35 using mojo::InterfaceRequest;
31 using mojo::ViewTreeHostFactory; 36 using mojo::ViewTreeHostFactory;
32 37
33 namespace view_manager { 38 namespace view_manager {
34 39
35 ViewManagerApp::ViewManagerApp() 40 ViewManagerApp::ViewManagerApp()
36 : app_impl_(nullptr), 41 : app_impl_(nullptr),
37 is_headless_(false) { 42 is_headless_(false) {
38 } 43 }
39 44
40 ViewManagerApp::~ViewManagerApp() { 45 ViewManagerApp::~ViewManagerApp() {
41 if (gpu_state_) 46 if (gpu_state_)
42 gpu_state_->StopControlThread(); 47 gpu_state_->StopControlThread();
43 } 48 }
44 49
45 void ViewManagerApp::Initialize(ApplicationImpl* app) { 50 void ViewManagerApp::Initialize(ApplicationImpl* app) {
46 app_impl_ = app; 51 app_impl_ = app;
47 tracing_.Initialize(app); 52 tracing_.Initialize(app);
48 surfaces_state_ = new surfaces::SurfacesState; 53 surfaces_state_ = new surfaces::SurfacesState;
49 54
50 #if !defined(OS_ANDROID) 55 #if !defined(OS_ANDROID)
51 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 56 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
52 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); 57 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig);
53 if (!is_headless_) { 58 if (!is_headless_) {
59 #if defined(USE_X11)
60 if (command_line->HasSwitch(mojo::kUseX11TestConfig)) {
61 XInitThreads();
62 ui::test::SetUseOverrideRedirectWindowByDefault(true);
63 }
64 #endif
65 gfx::GLSurface::InitializeOneOff();
54 event_source_ = ui::PlatformEventSource::CreateDefault(); 66 event_source_ = ui::PlatformEventSource::CreateDefault();
55 if (command_line->HasSwitch(mojo::kUseTestConfig))
56 gfx::GLSurfaceTestSupport::InitializeOneOff();
57 else
58 gfx::GLSurface::InitializeOneOff();
59 } 67 }
60 #endif 68 #endif
61 69
62 if (!gpu_state_.get()) 70 if (!gpu_state_.get())
63 gpu_state_ = new gles2::GpuState; 71 gpu_state_ = new gles2::GpuState;
64 connection_manager_.reset(new ConnectionManager(this, surfaces_state_)); 72 connection_manager_.reset(new ConnectionManager(this, surfaces_state_));
65 } 73 }
66 74
67 bool ViewManagerApp::ConfigureIncomingConnection( 75 bool ViewManagerApp::ConfigureIncomingConnection(
68 ApplicationConnection* connection) { 76 ApplicationConnection* connection) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_, 138 host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_,
131 gpu_state_, surfaces_state_); 139 gpu_state_, surfaces_state_);
132 140
133 // ViewTreeHostConnection manages its own lifetime. 141 // ViewTreeHostConnection manages its own lifetime.
134 host_impl->Init(new ViewTreeHostConnectionImpl( 142 host_impl->Init(new ViewTreeHostConnectionImpl(
135 host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(), 143 host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(),
136 connection_manager_.get())); 144 connection_manager_.get()));
137 } 145 }
138 146
139 } // namespace view_manager 147 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/view_manager/public/cpp/lib/args.cc ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698