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

Unified Diff: services/native_viewport/app_delegate.cc

Issue 2011383002: Get rid of {Run,Terminate}MainApplication(), and more ApplicationDelegate conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/native_viewport/app_delegate.h ('k') | services/native_viewport/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/native_viewport/app_delegate.cc
diff --git a/services/native_viewport/app_delegate.cc b/services/native_viewport/app_delegate.cc
deleted file mode 100644
index e0aeda1bcc45876bccc91126745340186f0a81ce..0000000000000000000000000000000000000000
--- a/services/native_viewport/app_delegate.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/native_viewport/app_delegate.h"
-
-#include <vector>
-
-#include "gpu/config/gpu_util.h"
-
-namespace native_viewport {
-
-NativeViewportAppDelegate::NativeViewportAppDelegate() : is_headless_(false) {}
-
-NativeViewportAppDelegate::~NativeViewportAppDelegate() {}
-
-void NativeViewportAppDelegate::InitLogging(
- mojo::ApplicationImpl* application) {
- std::vector<const char*> args;
- for (auto& a : application->args()) {
- args.push_back(a.c_str());
- }
-
- base::CommandLine::Reset();
- base::CommandLine::Init(args.size(), args.data());
-
- logging::LoggingSettings settings;
- settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
- logging::InitLogging(settings);
-}
-
-void NativeViewportAppDelegate::Initialize(mojo::ApplicationImpl* application) {
- application_ = application;
-
- InitLogging(application);
- tracing_.Initialize(application->shell(), &application->args());
-
- // Apply the switch for kTouchEvents to CommandLine (if set). This allows
- // redirecting the mouse to a touch device on X for testing.
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- const std::string touch_event_string("--" +
- std::string(switches::kTouchDevices));
- auto touch_iter = std::find(application->args().begin(),
- application->args().end(), touch_event_string);
- if (touch_iter != application->args().end() &&
- ++touch_iter != application->args().end()) {
- command_line->AppendSwitchASCII(touch_event_string, *touch_iter);
- }
-
- gpu::ApplyGpuDriverBugWorkarounds(command_line);
-
- if (application->HasArg(mojo::kUseTestConfig))
- gfx::GLSurface::InitializeOneOffForTests();
- else if (application->HasArg(mojo::kUseOSMesa))
- gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL);
- else
- gfx::GLSurface::InitializeOneOff();
-
- is_headless_ = application->HasArg(mojo::kUseHeadlessConfig);
-}
-
-bool NativeViewportAppDelegate::ConfigureIncomingConnection(
- mojo::ServiceProviderImpl* service_provider_impl) {
- service_provider_impl->AddService<mojo::NativeViewport>([this](
- const mojo::ConnectionContext& connection_context,
- mojo::InterfaceRequest<mojo::NativeViewport> native_viewport_request) {
- if (!gpu_state_.get())
- gpu_state_ = new gles2::GpuState();
- new NativeViewportImpl(application_->shell(), is_headless_, gpu_state_,
- native_viewport_request.Pass());
- });
-
- service_provider_impl->AddService<mojo::Gpu>(
- [this](const mojo::ConnectionContext& connection_context,
- mojo::InterfaceRequest<mojo::Gpu> gpu_request) {
- if (!gpu_state_.get())
- gpu_state_ = new gles2::GpuState();
- new gles2::GpuImpl(gpu_request.Pass(), gpu_state_);
- });
-
- return true;
-}
-
-} // namespace native_viewport
« no previous file with comments | « services/native_viewport/app_delegate.h ('k') | services/native_viewport/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698