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

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

Issue 657393003: Make ApplicationImpl::args() be a std::vector<std::string> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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 "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 "gpu/command_buffer/service/mailbox_manager.h" 7 #include "gpu/command_buffer/service/mailbox_manager.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/public/c/system/main.h" 9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 14 matching lines...) Expand all
25 public InterfaceFactory<Gpu> { 25 public InterfaceFactory<Gpu> {
26 public: 26 public:
27 NativeViewportAppDelegate() 27 NativeViewportAppDelegate()
28 : share_group_(new gfx::GLShareGroup), 28 : share_group_(new gfx::GLShareGroup),
29 mailbox_manager_(new gpu::gles2::MailboxManager), 29 mailbox_manager_(new gpu::gles2::MailboxManager),
30 is_headless_(false) {} 30 is_headless_(false) {}
31 virtual ~NativeViewportAppDelegate() {} 31 virtual ~NativeViewportAppDelegate() {}
32 32
33 private: 33 private:
34 bool HasArg(const std::string& arg) { 34 bool HasArg(const std::string& arg) {
35 return std::find(args_.begin(), args_.end(), arg) != args_.end(); 35 const auto& args = app_->args();
36 return std::find(args.begin(), args.end(), arg) != args.end();
36 } 37 }
37 38
38 // ApplicationDelegate implementation. 39 // ApplicationDelegate implementation.
39 virtual void Initialize(ApplicationImpl* application) override { 40 virtual void Initialize(ApplicationImpl* application) override {
40 app_ = application; 41 app_ = application;
41 args_ = application->args().To<std::vector<std::string> >();
42 42
43 #if !defined(COMPONENT_BUILD) 43 #if !defined(COMPONENT_BUILD)
44 if (HasArg(kUseTestConfig)) 44 if (HasArg(kUseTestConfig))
45 gfx::GLSurface::InitializeOneOffForTests(); 45 gfx::GLSurface::InitializeOneOffForTests();
46 else 46 else
47 gfx::GLSurface::InitializeOneOff(); 47 gfx::GLSurface::InitializeOneOff();
48 #endif 48 #endif
49 is_headless_ = HasArg(kUseHeadlessConfig); 49 is_headless_ = HasArg(kUseHeadlessConfig);
50 } 50 }
51 51
(...skipping 11 matching lines...) Expand all
63 } 63 }
64 64
65 // InterfaceFactory<Gpu> implementation. 65 // InterfaceFactory<Gpu> implementation.
66 virtual void Create(ApplicationConnection* connection, 66 virtual void Create(ApplicationConnection* connection,
67 InterfaceRequest<Gpu> request) override { 67 InterfaceRequest<Gpu> request) override {
68 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()), 68 BindToRequest(new GpuImpl(share_group_.get(), mailbox_manager_.get()),
69 &request); 69 &request);
70 } 70 }
71 71
72 ApplicationImpl* app_; 72 ApplicationImpl* app_;
73 std::vector<std::string> args_;
74 scoped_refptr<gfx::GLShareGroup> share_group_; 73 scoped_refptr<gfx::GLShareGroup> share_group_;
75 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 74 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
76 bool is_headless_; 75 bool is_headless_;
77 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate); 76 DISALLOW_COPY_AND_ASSIGN(NativeViewportAppDelegate);
78 }; 77 };
79 } 78 }
80 79
81 MojoResult MojoMain(MojoHandle shell_handle) { 80 MojoResult MojoMain(MojoHandle shell_handle) {
82 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate); 81 mojo::ApplicationRunnerChromium runner(new mojo::NativeViewportAppDelegate);
83 runner.set_message_loop_type(base::MessageLoop::TYPE_UI); 82 runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
84 return runner.Run(shell_handle); 83 return runner.Run(shell_handle);
85 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698