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" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 118 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
119 font_loader_ = skia::AdoptRef(new font_service::FontLoader(app_)); | 119 font_loader_ = skia::AdoptRef(new font_service::FontLoader(app_)); |
120 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 120 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
121 #endif | 121 #endif |
122 | 122 |
123 ui_init_.reset(new ui::mojo::UIInit( | 123 ui_init_.reset(new ui::mojo::UIInit( |
124 DisplaysFromSizeAndScale(screen_size_in_pixels_, device_pixel_ratio_))); | 124 DisplaysFromSizeAndScale(screen_size_in_pixels_, device_pixel_ratio_))); |
125 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 125 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
126 | 126 |
127 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 127 app_->ConnectToService("mojo:mus", &gpu_service_); |
128 request->url = mojo::String::From("mojo:mus"); | |
129 app_->ConnectToService(request.Pass(), &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 renderer_scheduler_ = scheduler::RendererScheduler::Create(); | 131 renderer_scheduler_ = scheduler::RendererScheduler::Create(); |
134 blink_platform_.reset( | 132 blink_platform_.reset( |
135 new BlinkPlatformImpl(this, app_, renderer_scheduler_.get())); | 133 new BlinkPlatformImpl(this, app_, renderer_scheduler_.get())); |
136 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 134 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
137 gin::V8Initializer::LoadV8SnapshotFromFD( | 135 gin::V8Initializer::LoadV8SnapshotFromFD( |
138 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), | 136 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), |
139 0u, 0u); | 137 0u, 0u); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return gpu_info_.get(); | 185 return gpu_info_.get(); |
188 } | 186 } |
189 | 187 |
190 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { | 188 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { |
191 CHECK(gpu_info); | 189 CHECK(gpu_info); |
192 gpu_info_ = gpu_info.Pass(); | 190 gpu_info_ = gpu_info.Pass(); |
193 gpu_service_.reset(); | 191 gpu_service_.reset(); |
194 } | 192 } |
195 | 193 |
196 } // namespace html_viewer | 194 } // namespace html_viewer |
OLD | NEW |