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

Side by Side Diff: components/mus/mus_app.cc

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated all the namespaces in mus 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
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/mus/view_manager_app.h" 5 #include "components/mus/mus_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/mus/client_connection.h" 9 #include "components/mus/client_connection.h"
10 #include "components/mus/connection_manager.h" 10 #include "components/mus/connection_manager.h"
11 #include "components/mus/gles2/gpu_impl.h" 11 #include "components/mus/gles2/gpu_impl.h"
12 #include "components/mus/public/cpp/args.h" 12 #include "components/mus/public/cpp/args.h"
13 #include "components/mus/surfaces/surfaces_scheduler.h" 13 #include "components/mus/surfaces/surfaces_scheduler.h"
14 #include "components/mus/view_tree_host_connection.h" 14 #include "components/mus/view_tree_host_connection.h"
15 #include "components/mus/view_tree_host_impl.h" 15 #include "components/mus/view_tree_host_impl.h"
(...skipping 12 matching lines...) Expand all
28 #include <X11/Xlib.h> 28 #include <X11/Xlib.h>
29 #include "ui/platform_window/x11/x11_window.h" 29 #include "ui/platform_window/x11/x11_window.h"
30 #endif 30 #endif
31 31
32 using mojo::ApplicationConnection; 32 using mojo::ApplicationConnection;
33 using mojo::ApplicationImpl; 33 using mojo::ApplicationImpl;
34 using mojo::Gpu; 34 using mojo::Gpu;
35 using mojo::InterfaceRequest; 35 using mojo::InterfaceRequest;
36 using mojo::ViewTreeHostFactory; 36 using mojo::ViewTreeHostFactory;
37 37
38 namespace view_manager { 38 namespace mus {
39 39
40 ViewManagerApp::ViewManagerApp() : app_impl_(nullptr), is_headless_(false) {} 40 MandolineUIServicesApp::MandolineUIServicesApp()
41 : app_impl_(nullptr), is_headless_(false) {}
41 42
42 ViewManagerApp::~ViewManagerApp() { 43 MandolineUIServicesApp::~MandolineUIServicesApp() {
43 if (gpu_state_) 44 if (gpu_state_)
44 gpu_state_->StopControlThread(); 45 gpu_state_->StopControlThread();
45 // Destroy |connection_manager_| first, since it depends on |event_source_|. 46 // Destroy |connection_manager_| first, since it depends on |event_source_|.
46 connection_manager_.reset(); 47 connection_manager_.reset();
47 } 48 }
48 49
49 void ViewManagerApp::Initialize(ApplicationImpl* app) { 50 void MandolineUIServicesApp::Initialize(ApplicationImpl* app) {
50 app_impl_ = app; 51 app_impl_ = app;
51 tracing_.Initialize(app); 52 tracing_.Initialize(app);
52 surfaces_state_ = new surfaces::SurfacesState; 53 surfaces_state_ = new SurfacesState;
53 54
54 #if !defined(OS_ANDROID) 55 #if !defined(OS_ANDROID)
55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 56 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
56 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); 57 is_headless_ = command_line->HasSwitch(kUseHeadlessConfig);
57 if (!is_headless_) { 58 if (!is_headless_) {
58 #if defined(USE_X11) 59 #if defined(USE_X11)
59 if (command_line->HasSwitch(mojo::kUseX11TestConfig)) { 60 if (command_line->HasSwitch(kUseX11TestConfig)) {
60 XInitThreads(); 61 XInitThreads();
61 ui::test::SetUseOverrideRedirectWindowByDefault(true); 62 ui::test::SetUseOverrideRedirectWindowByDefault(true);
62 } 63 }
63 #endif 64 #endif
64 gfx::GLSurface::InitializeOneOff(); 65 gfx::GLSurface::InitializeOneOff();
65 event_source_ = ui::PlatformEventSource::CreateDefault(); 66 event_source_ = ui::PlatformEventSource::CreateDefault();
66 } 67 }
67 #endif 68 #endif
68 69
69 if (!gpu_state_.get()) 70 if (!gpu_state_.get())
70 gpu_state_ = new gles2::GpuState; 71 gpu_state_ = new GpuState;
71 connection_manager_.reset(new ConnectionManager(this, surfaces_state_)); 72 connection_manager_.reset(new ConnectionManager(this, surfaces_state_));
72 } 73 }
73 74
74 bool ViewManagerApp::ConfigureIncomingConnection( 75 bool MandolineUIServicesApp::ConfigureIncomingConnection(
75 ApplicationConnection* connection) { 76 ApplicationConnection* connection) {
76 // ViewManager 77 // MandolineUIServices
77 connection->AddService<ViewTreeHostFactory>(this); 78 connection->AddService<ViewTreeHostFactory>(this);
78 // GPU 79 // GPU
79 connection->AddService<Gpu>(this); 80 connection->AddService<Gpu>(this);
80 return true; 81 return true;
81 } 82 }
82 83
83 void ViewManagerApp::OnNoMoreRootConnections() { 84 void MandolineUIServicesApp::OnNoMoreRootConnections() {
84 app_impl_->Quit(); 85 app_impl_->Quit();
85 } 86 }
86 87
87 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( 88 ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView(
88 ConnectionManager* connection_manager, 89 ConnectionManager* connection_manager,
89 mojo::InterfaceRequest<mojo::ViewTree> tree_request, 90 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
90 mojo::ConnectionSpecificId creator_id, 91 ConnectionSpecificId creator_id,
91 mojo::URLRequestPtr request, 92 mojo::URLRequestPtr request,
92 const ViewId& root_id) { 93 const ViewId& root_id) {
93 mojo::ViewTreeClientPtr client; 94 mojo::ViewTreeClientPtr client;
94 app_impl_->ConnectToService(request.Pass(), &client); 95 app_impl_->ConnectToService(request.Pass(), &client);
95 96
96 scoped_ptr<ViewTreeImpl> service( 97 scoped_ptr<ViewTreeImpl> service(
97 new ViewTreeImpl(connection_manager, creator_id, root_id)); 98 new ViewTreeImpl(connection_manager, creator_id, root_id));
98 return new DefaultClientConnection(service.Pass(), connection_manager, 99 return new DefaultClientConnection(service.Pass(), connection_manager,
99 tree_request.Pass(), client.Pass()); 100 tree_request.Pass(), client.Pass());
100 } 101 }
101 102
102 ClientConnection* ViewManagerApp::CreateClientConnectionForEmbedAtView( 103 ClientConnection* MandolineUIServicesApp::CreateClientConnectionForEmbedAtView(
103 ConnectionManager* connection_manager, 104 ConnectionManager* connection_manager,
104 mojo::InterfaceRequest<mojo::ViewTree> tree_request, 105 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
105 mojo::ConnectionSpecificId creator_id, 106 ConnectionSpecificId creator_id,
106 const ViewId& root_id, 107 const ViewId& root_id,
107 mojo::ViewTreeClientPtr client) { 108 mojo::ViewTreeClientPtr client) {
108 scoped_ptr<ViewTreeImpl> service( 109 scoped_ptr<ViewTreeImpl> service(
109 new ViewTreeImpl(connection_manager, creator_id, root_id)); 110 new ViewTreeImpl(connection_manager, creator_id, root_id));
110 return new DefaultClientConnection(service.Pass(), connection_manager, 111 return new DefaultClientConnection(service.Pass(), connection_manager,
111 tree_request.Pass(), client.Pass()); 112 tree_request.Pass(), client.Pass());
112 } 113 }
113 114
114 void ViewManagerApp::Create(ApplicationConnection* connection, 115 void MandolineUIServicesApp::Create(
115 InterfaceRequest<ViewTreeHostFactory> request) { 116 ApplicationConnection* connection,
117 InterfaceRequest<ViewTreeHostFactory> request) {
116 factory_bindings_.AddBinding(this, request.Pass()); 118 factory_bindings_.AddBinding(this, request.Pass());
117 } 119 }
118 120
119 void ViewManagerApp::Create(mojo::ApplicationConnection* connection, 121 void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection,
120 mojo::InterfaceRequest<Gpu> request) { 122 mojo::InterfaceRequest<Gpu> request) {
121 if (!gpu_state_.get()) 123 if (!gpu_state_.get())
122 gpu_state_ = new gles2::GpuState; 124 gpu_state_ = new GpuState;
123 new gles2::GpuImpl(request.Pass(), gpu_state_); 125 new GpuImpl(request.Pass(), gpu_state_);
124 } 126 }
125 127
126 void ViewManagerApp::CreateViewTreeHost( 128 void MandolineUIServicesApp::CreateViewTreeHost(
127 mojo::InterfaceRequest<mojo::ViewTreeHost> host, 129 mojo::InterfaceRequest<mojo::ViewTreeHost> host,
128 mojo::ViewTreeHostClientPtr host_client, 130 mojo::ViewTreeHostClientPtr host_client,
129 mojo::ViewTreeClientPtr tree_client) { 131 mojo::ViewTreeClientPtr tree_client) {
130 DCHECK(connection_manager_.get()); 132 DCHECK(connection_manager_.get());
131 133
132 // TODO(fsamuel): We need to make sure that only the window manager can create 134 // TODO(fsamuel): We need to make sure that only the window manager can create
133 // new roots. 135 // new roots.
134 ViewTreeHostImpl* host_impl = new ViewTreeHostImpl( 136 ViewTreeHostImpl* host_impl = new ViewTreeHostImpl(
135 host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_, 137 host_client.Pass(), connection_manager_.get(), is_headless_, app_impl_,
136 gpu_state_, surfaces_state_); 138 gpu_state_, surfaces_state_);
137 139
138 // ViewTreeHostConnection manages its own lifetime. 140 // ViewTreeHostConnection manages its own lifetime.
139 host_impl->Init(new ViewTreeHostConnectionImpl( 141 host_impl->Init(new ViewTreeHostConnectionImpl(
140 host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(), 142 host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(),
141 connection_manager_.get())); 143 connection_manager_.get()));
142 } 144 }
143 145
144 } // namespace view_manager 146 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698