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

Side by Side Diff: mojo/services/native_viewport/main.cc

Issue 769963004: Add tracing service and make the shell+sky_viewer+services talk to it (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 unified diff | Download patch
« no previous file with comments | « mojo/services/native_viewport/BUILD.gn ('k') | mojo/services/surfaces/BUILD.gn » ('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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/common/tracing_impl.h"
8 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
9 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/application_delegate.h" 11 #include "mojo/public/cpp/application/application_delegate.h"
11 #include "mojo/public/cpp/application/application_impl.h" 12 #include "mojo/public/cpp/application/application_impl.h"
12 #include "mojo/public/cpp/application/interface_factory_impl.h" 13 #include "mojo/public/cpp/application/interface_factory_impl.h"
13 #include "mojo/services/gles2/gpu_impl.h" 14 #include "mojo/services/gles2/gpu_impl.h"
14 #include "mojo/services/native_viewport/native_viewport_impl.h" 15 #include "mojo/services/native_viewport/native_viewport_impl.h"
15 #include "mojo/services/public/cpp/native_viewport/args.h" 16 #include "mojo/services/public/cpp/native_viewport/args.h"
16 #include "ui/gl/gl_surface.h" 17 #include "ui/gl/gl_surface.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 20
20 class NativeViewportAppDelegate 21 class NativeViewportAppDelegate
21 : public ApplicationDelegate, 22 : public ApplicationDelegate,
22 public InterfaceFactory<NativeViewport>, 23 public InterfaceFactory<NativeViewport>,
23 public InterfaceFactory<Gpu> { 24 public InterfaceFactory<Gpu> {
24 public: 25 public:
25 NativeViewportAppDelegate() : is_headless_(false) {} 26 NativeViewportAppDelegate() : is_headless_(false) {}
26 ~NativeViewportAppDelegate() override {} 27 ~NativeViewportAppDelegate() override {}
27 28
28 private: 29 private:
29 // ApplicationDelegate implementation. 30 // ApplicationDelegate implementation.
30 void Initialize(ApplicationImpl* application) override { 31 void Initialize(ApplicationImpl* application) override {
31 app_ = application; 32 app_ = application;
32 33
34 TracingImpl::Create(application);
35
33 if (app_->HasArg(kUseTestConfig)) 36 if (app_->HasArg(kUseTestConfig))
34 gfx::GLSurface::InitializeOneOffForTests(); 37 gfx::GLSurface::InitializeOneOffForTests();
35 else if (app_->HasArg(kUseOSMesa)) 38 else if (app_->HasArg(kUseOSMesa))
36 gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL); 39 gfx::GLSurface::InitializeOneOff(gfx::kGLImplementationOSMesaGL);
37 else 40 else
38 gfx::GLSurface::InitializeOneOff(); 41 gfx::GLSurface::InitializeOneOff();
39 42
40 is_headless_ = app_->HasArg(kUseHeadlessConfig); 43 is_headless_ = app_->HasArg(kUseHeadlessConfig);
41 } 44 }
42 45
(...skipping 23 matching lines...) Expand all
66 bool is_headless_; 69 bool is_headless_;
67 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); 70 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
68 }; 71 };
69 } 72 }
70 73
71 MojoResult MojoMain(MojoHandle shell_handle) { 74 MojoResult MojoMain(MojoHandle shell_handle) {
72 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate); 75 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate);
73 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); 76 runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
74 return runner.Run(shell_handle); 77 return runner.Run(shell_handle);
75 } 78 }
OLDNEW
« no previous file with comments | « mojo/services/native_viewport/BUILD.gn ('k') | mojo/services/surfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698