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

Side by Side Diff: components/html_viewer/setup.cc

Issue 1166123005: Removes ServiceProviders from ViewManager::Embed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use is_headless rather than check for browser. Created 5 years, 6 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
« no previous file with comments | « components/html_viewer/setup.h ('k') | components/view_manager/connection_manager.h » ('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 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/html_viewer/setup.h" 5 #include "components/html_viewer/setup.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Setup::Setup(mojo::ApplicationImpl* app) 68 Setup::Setup(mojo::ApplicationImpl* app)
69 : app_(app), 69 : app_(app),
70 resource_loader_(app->shell(), GetResourcePaths()), 70 resource_loader_(app->shell(), GetResourcePaths()),
71 is_headless_( 71 is_headless_(
72 base::CommandLine::ForCurrentProcess()->HasSwitch(kIsHeadless)), 72 base::CommandLine::ForCurrentProcess()->HasSwitch(kIsHeadless)),
73 did_init_(false), 73 did_init_(false),
74 device_pixel_ratio_(1.f), 74 device_pixel_ratio_(1.f),
75 discardable_memory_allocator_(kDesiredMaxMemory), 75 discardable_memory_allocator_(kDesiredMaxMemory),
76 compositor_thread_("compositor thread") { 76 compositor_thread_("compositor thread") {
77 if (is_headless_) 77 if (is_headless_)
78 InitHeadless(); 78 InitIfNecessary(gfx::Size(1024, 1024), 1.f);
79 } 79 }
80 80
81 Setup::~Setup() { 81 Setup::~Setup() {
82 if (blink_platform_) { 82 if (blink_platform_) {
83 renderer_scheduler_->Shutdown(); 83 renderer_scheduler_->Shutdown();
84 blink::shutdown(); 84 blink::shutdown();
85 } 85 }
86 } 86 }
87 87
88 void Setup::InitHeadless() {
89 DCHECK(!did_init_);
90 is_headless_ = true;
91 InitIfNecessary(gfx::Size(1024, 1024), 1.f);
92 }
93
94 void Setup::InitIfNecessary(const gfx::Size& screen_size_in_pixels, 88 void Setup::InitIfNecessary(const gfx::Size& screen_size_in_pixels,
95 float device_pixel_ratio) { 89 float device_pixel_ratio) {
96 if (did_init_) 90 if (did_init_)
97 return; 91 return;
98 92
99 DCHECK_NE(0.f, device_pixel_ratio); 93 DCHECK_NE(0.f, device_pixel_ratio);
100 94
101 did_init_ = true; 95 did_init_ = true;
102 device_pixel_ratio_ = device_pixel_ratio; 96 device_pixel_ratio_ = device_pixel_ratio;
103 screen_size_in_pixels_ = screen_size_in_pixels; 97 screen_size_in_pixels_ = screen_size_in_pixels;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 media_factory_.reset( 147 media_factory_.reset(
154 new MediaFactory(compositor_thread_.message_loop_proxy(), app_->shell())); 148 new MediaFactory(compositor_thread_.message_loop_proxy(), app_->shell()));
155 149
156 if (command_line->HasSwitch(kJavaScriptFlags)) { 150 if (command_line->HasSwitch(kJavaScriptFlags)) {
157 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags)); 151 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags));
158 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 152 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
159 } 153 }
160 } 154 }
161 155
162 } // namespace html_viewer 156 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/setup.h ('k') | components/view_manager/connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698