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

Unified Diff: mojo/services/native_viewport/main.cc

Issue 769173002: Move native_viewport and gles2 service impls to //services (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
Index: mojo/services/native_viewport/main.cc
diff --git a/mojo/services/native_viewport/main.cc b/mojo/services/native_viewport/main.cc
deleted file mode 100644
index 1a71ccd4ab67b5900b2d4ff22f673c09601885f0..0000000000000000000000000000000000000000
--- a/mojo/services/native_viewport/main.cc
+++ /dev/null
@@ -1,78 +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 "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "mojo/application/application_runner_chromium.h"
-#include "mojo/common/tracing_impl.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_connection.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/interface_factory_impl.h"
-#include "mojo/services/gles2/gpu_impl.h"
-#include "mojo/services/native_viewport/native_viewport_impl.h"
-#include "mojo/services/public/cpp/native_viewport/args.h"
-#include "ui/gl/gl_surface.h"
-
-namespace mojo {
-
-class NativeViewportAppDelegate
- : public ApplicationDelegate,
- public InterfaceFactory<NativeViewport>,
- public InterfaceFactory<Gpu> {
- public:
- NativeViewportAppDelegate() : is_headless_(false) {}
- ~NativeViewportAppDelegate() override {}
-
- private:
- // ApplicationDelegate implementation.
- void Initialize(ApplicationImpl* application) override {
- app_ = application;
-
- TracingImpl::Create(application);
-
- if (app_->HasArg(kUseTestConfig))
- gfx::GLSurface::InitializeOneOffForTests();
- else if (app_->HasArg(kUseOSMesa))
- gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL);
- else
- gfx::GLSurface::InitializeOneOff();
-
- is_headless_ = app_->HasArg(kUseHeadlessConfig);
- }
-
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override {
- connection->AddService<NativeViewport>(this);
- connection->AddService<Gpu>(this);
- return true;
- }
-
- // InterfaceFactory<NativeViewport> implementation.
- void Create(ApplicationConnection* connection,
- InterfaceRequest<NativeViewport> request) override {
- BindToRequest(new NativeViewportImpl(app_, is_headless_), &request);
- }
-
- // InterfaceFactory<Gpu> implementation.
- void Create(ApplicationConnection* connection,
- InterfaceRequest<Gpu> request) override {
- if (!gpu_state_.get())
- gpu_state_ = new GpuImpl::State;
- new GpuImpl(request.Pass(), gpu_state_);
- }
-
- ApplicationImpl* app_;
- scoped_refptr<GpuImpl::State> gpu_state_;
- bool is_headless_;
- DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
-};
-}
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate);
- runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
- return runner.Run(shell_handle);
-}

Powered by Google App Engine
This is Rietveld 408576698