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

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

Issue 1276163002: Revert of Sandbox html_viewer on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/DEPS ('k') | components/html_viewer/html_viewer_main.cc » ('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/global_state.h" 5 #include "components/html_viewer/global_state.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"
11 #include "base/i18n/icu_util.h" 11 #include "base/i18n/icu_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "components/html_viewer/blink_platform_impl.h" 13 #include "components/html_viewer/blink_platform_impl.h"
14 #include "components/html_viewer/media_factory.h" 14 #include "components/html_viewer/media_factory.h"
15 #include "components/scheduler/renderer/renderer_scheduler.h" 15 #include "components/scheduler/renderer/renderer_scheduler.h"
16 #include "gin/v8_initializer.h" 16 #include "gin/v8_initializer.h"
17 #include "mojo/application/public/cpp/application_impl.h" 17 #include "mojo/application/public/cpp/application_impl.h"
18 #include "third_party/WebKit/public/web/WebKit.h" 18 #include "third_party/WebKit/public/web/WebKit.h"
19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/base/ui_base_paths.h" 21 #include "ui/base/ui_base_paths.h"
22 #include "ui/mojo/init/ui_init.h" 22 #include "ui/mojo/init/ui_init.h"
23 #include "v8/include/v8.h" 23 #include "v8/include/v8.h"
24 24
25 #if defined(OS_LINUX) && !defined(OS_ANDROID)
26 #include "components/font_service/public/cpp/font_loader.h"
27 #endif
28
29 namespace html_viewer { 25 namespace html_viewer {
30 26
31 namespace { 27 namespace {
32 28
33 // Disables support for (unprefixed) Encrypted Media Extensions. 29 // Disables support for (unprefixed) Encrypted Media Extensions.
34 const char kDisableEncryptedMedia[] = "disable-encrypted-media"; 30 const char kDisableEncryptedMedia[] = "disable-encrypted-media";
35 31
36 // Prevents creation of any output surface. 32 // Prevents creation of any output surface.
37 const char kIsHeadless[] = "is-headless"; 33 const char kIsHeadless[] = "is-headless";
38 34
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 did_init_ = true; 86 did_init_ = true;
91 device_pixel_ratio_ = device_pixel_ratio; 87 device_pixel_ratio_ = device_pixel_ratio;
92 screen_size_in_pixels_ = screen_size_in_pixels; 88 screen_size_in_pixels_ = screen_size_in_pixels;
93 89
94 if (!resource_loader_.BlockUntilLoaded()) { 90 if (!resource_loader_.BlockUntilLoaded()) {
95 // Assume on error we're being shut down. 91 // Assume on error we're being shut down.
96 app_->Terminate(); 92 app_->Terminate();
97 return; 93 return;
98 } 94 }
99 95
100 #if defined(OS_LINUX) && !defined(OS_ANDROID)
101 SkFontConfigInterface::SetGlobal(new font_service::FontLoader(app_));
102 #endif
103
104 ui_init_.reset( 96 ui_init_.reset(
105 new ui::mojo::UIInit(screen_size_in_pixels, device_pixel_ratio)); 97 new ui::mojo::UIInit(screen_size_in_pixels, device_pixel_ratio));
106 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); 98 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
107 99
108 renderer_scheduler_ = scheduler::RendererScheduler::Create(); 100 renderer_scheduler_ = scheduler::RendererScheduler::Create();
109 blink_platform_.reset(new BlinkPlatformImpl(app_, renderer_scheduler_.get())); 101 blink_platform_.reset(new BlinkPlatformImpl(app_, renderer_scheduler_.get()));
110 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 102 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
111 gin::V8Initializer::LoadV8SnapshotFromFD( 103 gin::V8Initializer::LoadV8SnapshotFromFD(
112 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), 104 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(),
113 0u, 0u); 105 0u, 0u);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 media_factory_.reset( 140 media_factory_.reset(
149 new MediaFactory(compositor_thread_.task_runner(), app_->shell())); 141 new MediaFactory(compositor_thread_.task_runner(), app_->shell()));
150 142
151 if (command_line->HasSwitch(kJavaScriptFlags)) { 143 if (command_line->HasSwitch(kJavaScriptFlags)) {
152 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags)); 144 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags));
153 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 145 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
154 } 146 }
155 } 147 }
156 148
157 } // namespace html_viewer 149 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/DEPS ('k') | components/html_viewer/html_viewer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698