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