OLD | NEW |
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/logging.h" | 11 #include "base/logging.h" |
12 #include "cc/blink/web_layer_impl.h" | |
13 #include "cc/layers/layer_settings.h" | |
14 #include "components/html_viewer/blink_platform_impl.h" | 12 #include "components/html_viewer/blink_platform_impl.h" |
15 #include "components/html_viewer/blink_settings_impl.h" | 13 #include "components/html_viewer/blink_settings_impl.h" |
16 #include "components/html_viewer/media_factory.h" | 14 #include "components/html_viewer/media_factory.h" |
17 #include "components/scheduler/renderer/renderer_scheduler.h" | 15 #include "components/scheduler/renderer/renderer_scheduler.h" |
18 #include "gin/v8_initializer.h" | 16 #include "gin/v8_initializer.h" |
19 #include "mojo/application/public/cpp/application_impl.h" | 17 #include "mojo/application/public/cpp/application_impl.h" |
20 #include "mojo/logging/init_logging.h" | 18 #include "mojo/logging/init_logging.h" |
21 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 19 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
22 #include "third_party/WebKit/public/web/WebKit.h" | 20 #include "third_party/WebKit/public/web/WebKit.h" |
23 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #endif | 121 #endif |
124 | 122 |
125 ui_init_.reset(new ui::mojo::UIInit( | 123 ui_init_.reset(new ui::mojo::UIInit( |
126 DisplaysFromSizeAndScale(screen_size_in_pixels_, device_pixel_ratio_))); | 124 DisplaysFromSizeAndScale(screen_size_in_pixels_, device_pixel_ratio_))); |
127 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 125 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
128 | 126 |
129 app_->ConnectToService("mojo:mus", &gpu_service_); | 127 app_->ConnectToService("mojo:mus", &gpu_service_); |
130 gpu_service_->GetGpuInfo(base::Bind(&GlobalState::GetGpuInfoCallback, | 128 gpu_service_->GetGpuInfo(base::Bind(&GlobalState::GetGpuInfoCallback, |
131 base::Unretained(this))); | 129 base::Unretained(this))); |
132 | 130 |
133 // Use new animation system (cc::AnimationHost). | |
134 cc::LayerSettings layer_settings; | |
135 layer_settings.use_compositor_animation_timelines = true; | |
136 cc_blink::WebLayerImpl::SetLayerSettings(layer_settings); | |
137 blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); | |
138 | |
139 renderer_scheduler_ = scheduler::RendererScheduler::Create(); | 131 renderer_scheduler_ = scheduler::RendererScheduler::Create(); |
140 blink_platform_.reset( | 132 blink_platform_.reset( |
141 new BlinkPlatformImpl(this, app_, renderer_scheduler_.get())); | 133 new BlinkPlatformImpl(this, app_, renderer_scheduler_.get())); |
142 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 134 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
143 gin::V8Initializer::LoadV8SnapshotFromFD( | 135 gin::V8Initializer::LoadV8SnapshotFromFD( |
144 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), | 136 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), |
145 0u, 0u); | 137 0u, 0u); |
146 gin::V8Initializer::LoadV8NativesFromFD( | 138 gin::V8Initializer::LoadV8NativesFromFD( |
147 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, | 139 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, |
148 0u); | 140 0u); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return gpu_info_.get(); | 185 return gpu_info_.get(); |
194 } | 186 } |
195 | 187 |
196 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { | 188 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { |
197 CHECK(gpu_info); | 189 CHECK(gpu_info); |
198 gpu_info_ = gpu_info.Pass(); | 190 gpu_info_ = gpu_info.Pass(); |
199 gpu_service_.reset(); | 191 gpu_service_.reset(); |
200 } | 192 } |
201 | 193 |
202 } // namespace html_viewer | 194 } // namespace html_viewer |
OLD | NEW |