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

Side by Side Diff: components/native_viewport/native_viewport_application_delegate.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/native_viewport/native_viewport_application_delegate.h" 5 #include "components/native_viewport/native_viewport_application_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "components/native_viewport/native_viewport_impl.h" 8 #include "components/native_viewport/native_viewport_impl.h"
9 #include "components/native_viewport/public/cpp/args.h" 9 #include "components/native_viewport/public/cpp/args.h"
10 #include "mojo/application/public/cpp/application_connection.h" 10 #include "mojo/application/public/cpp/application_connection.h"
11 #include "mojo/application/public/cpp/application_impl.h" 11 #include "mojo/application/public/cpp/application_impl.h"
12 #include "ui/events/event_switches.h" 12 #include "ui/events/event_switches.h"
13 #include "ui/events/platform/platform_event_source.h"
13 #include "ui/gl/gl_surface.h" 14 #include "ui/gl/gl_surface.h"
14 15
15 namespace native_viewport { 16 namespace native_viewport {
16 17
17 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate() 18 NativeViewportApplicationDelegate::NativeViewportApplicationDelegate()
18 : is_headless_(false) { 19 : is_headless_(false) {
19 } 20 }
20 21
21 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() { 22 NativeViewportApplicationDelegate::~NativeViewportApplicationDelegate() {
22 } 23 }
23 24
24 void NativeViewportApplicationDelegate::Initialize( 25 void NativeViewportApplicationDelegate::Initialize(
25 mojo::ApplicationImpl* application) { 26 mojo::ApplicationImpl* application) {
27 event_source_ = ui::PlatformEventSource::CreateDefault();
26 tracing_.Initialize(application); 28 tracing_.Initialize(application);
27 29
28 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 30 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
29 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig); 31 is_headless_ = command_line->HasSwitch(mojo::kUseHeadlessConfig);
30 if (!is_headless_) { 32 if (!is_headless_) {
31 if (command_line->HasSwitch(mojo::kUseTestConfig)) 33 if (command_line->HasSwitch(mojo::kUseTestConfig))
32 gfx::GLSurface::InitializeOneOffForTests(); 34 gfx::GLSurface::InitializeOneOffForTests();
33 else 35 else
34 gfx::GLSurface::InitializeOneOff(); 36 gfx::GLSurface::InitializeOneOff();
35 } 37 }
36 } 38 }
37 39
38 bool NativeViewportApplicationDelegate::ConfigureIncomingConnection( 40 bool NativeViewportApplicationDelegate::ConfigureIncomingConnection(
39 mojo::ApplicationConnection* connection) { 41 mojo::ApplicationConnection* connection) {
40 connection->AddService<mojo::NativeViewport>(this); 42 connection->AddService<mojo::NativeViewport>(this);
41 connection->AddService<mojo::Gpu>(this); 43 connection->AddService<mojo::Gpu>(this);
42 return true; 44 return true;
43 } 45 }
44 46
45 void NativeViewportApplicationDelegate::Create( 47 void NativeViewportApplicationDelegate::Create(
46 mojo::ApplicationConnection* connection, 48 mojo::ApplicationConnection* connection,
47 mojo::InterfaceRequest<mojo::NativeViewport> request) { 49 mojo::InterfaceRequest<mojo::NativeViewport> request) {
48 if (!gpu_state_.get()) 50 if (!gpu_state_.get())
49 gpu_state_ = new gles2::GpuState; 51 gpu_state_ = new gles2::GpuState;
50 new NativeViewportImpl(is_headless_, gpu_state_, request.Pass()); 52 new NativeViewportImpl(is_headless_, gpu_state_, request.Pass(),
53 app_lifetime_helper_.CreateAppRefCount());
51 } 54 }
52 55
53 void NativeViewportApplicationDelegate::Create( 56 void NativeViewportApplicationDelegate::Create(
54 mojo::ApplicationConnection* connection, 57 mojo::ApplicationConnection* connection,
55 mojo::InterfaceRequest<mojo::Gpu> request) { 58 mojo::InterfaceRequest<mojo::Gpu> request) {
56 if (!gpu_state_.get()) 59 if (!gpu_state_.get())
57 gpu_state_ = new gles2::GpuState; 60 gpu_state_ = new gles2::GpuState;
58 new gles2::GpuImpl(request.Pass(), gpu_state_); 61 new gles2::GpuImpl(request.Pass(), gpu_state_);
59 } 62 }
60 63
61 } // namespace native_viewport 64 } // namespace native_viewport
OLDNEW
« no previous file with comments | « components/native_viewport/native_viewport_application_delegate.h ('k') | components/native_viewport/native_viewport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698