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

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 1411843008: Make blink platform time consistent with the timer virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CachingCorrectnessTest Created 5 years, 1 month 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 | « content/renderer/renderer_blink_platform_impl.h ('k') | content/test/fake_renderer_scheduler.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/renderer_blink_platform_impl.h" 5 #include "content/renderer/renderer_blink_platform_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()), 235 : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()),
236 main_thread_( 236 main_thread_(
237 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), 237 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)),
238 clipboard_delegate_(new RendererClipboardDelegate), 238 clipboard_delegate_(new RendererClipboardDelegate),
239 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())), 239 clipboard_(new WebClipboardImpl(clipboard_delegate_.get())),
240 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry), 240 mime_registry_(new RendererBlinkPlatformImpl::MimeRegistry),
241 sudden_termination_disables_(0), 241 sudden_termination_disables_(0),
242 plugin_refresh_allowed_(true), 242 plugin_refresh_allowed_(true),
243 default_task_runner_(renderer_scheduler->DefaultTaskRunner()), 243 default_task_runner_(renderer_scheduler->DefaultTaskRunner()),
244 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()), 244 loading_task_runner_(renderer_scheduler->LoadingTaskRunner()),
245 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl) { 245 web_scrollbar_behavior_(new WebScrollbarBehaviorImpl),
246 renderer_scheduler_(renderer_scheduler) {
246 #if !defined(OS_ANDROID) && !defined(OS_WIN) 247 #if !defined(OS_ANDROID) && !defined(OS_WIN)
247 if (g_sandbox_enabled && sandboxEnabled()) { 248 if (g_sandbox_enabled && sandboxEnabled()) {
248 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport); 249 sandbox_support_.reset(new RendererBlinkPlatformImpl::SandboxSupport);
249 } else { 250 } else {
250 DVLOG(1) << "Disabling sandbox support for testing."; 251 DVLOG(1) << "Disabling sandbox support for testing.";
251 } 252 }
252 #endif 253 #endif
253 254
254 // ChildThread may not exist in some tests. 255 // ChildThread may not exist in some tests.
255 if (ChildThreadImpl::current()) { 256 if (ChildThreadImpl::current()) {
(...skipping 15 matching lines...) Expand all
271 #if !defined(OS_ANDROID) && !defined(OS_WIN) 272 #if !defined(OS_ANDROID) && !defined(OS_WIN)
272 // SandboxSupport contains a map of WebFontFamily objects, which hold 273 // SandboxSupport contains a map of WebFontFamily objects, which hold
273 // WebCStrings, which become invalidated when blink is shut down. Hence, we 274 // WebCStrings, which become invalidated when blink is shut down. Hence, we
274 // need to clear that map now, just before blink::shutdown() is called. 275 // need to clear that map now, just before blink::shutdown() is called.
275 sandbox_support_.reset(); 276 sandbox_support_.reset();
276 #endif 277 #endif
277 } 278 }
278 279
279 //------------------------------------------------------------------------------ 280 //------------------------------------------------------------------------------
280 281
282 double RendererBlinkPlatformImpl::currentTimeSeconds() {
283 return renderer_scheduler_->CurrentTimeSeconds();
284 }
285
286 double RendererBlinkPlatformImpl::monotonicallyIncreasingTimeSeconds() {
287 return renderer_scheduler_->MonotonicallyIncreasingTimeSeconds();
288 }
289
290 //------------------------------------------------------------------------------
291
281 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() { 292 blink::WebURLLoader* RendererBlinkPlatformImpl::createURLLoader() {
282 ChildThreadImpl* child_thread = ChildThreadImpl::current(); 293 ChildThreadImpl* child_thread = ChildThreadImpl::current();
283 // There may be no child thread in RenderViewTests. These tests can still use 294 // There may be no child thread in RenderViewTests. These tests can still use
284 // data URLs to bypass the ResourceDispatcher. 295 // data URLs to bypass the ResourceDispatcher.
285 scoped_ptr<scheduler::WebTaskRunnerImpl> task_runner( 296 scoped_ptr<scheduler::WebTaskRunnerImpl> task_runner(
286 new scheduler::WebTaskRunnerImpl( 297 new scheduler::WebTaskRunnerImpl(
287 loading_task_runner_->BelongsToCurrentThread() 298 loading_task_runner_->BelongsToCurrentThread()
288 ? loading_task_runner_ : base::ThreadTaskRunnerHandle::Get())); 299 ? loading_task_runner_ : base::ThreadTaskRunnerHandle::Get()));
289 return new content::WebURLLoaderImpl( 300 return new content::WebURLLoaderImpl(
290 child_thread ? child_thread->resource_dispatcher() : NULL, 301 child_thread ? child_thread->resource_dispatcher() : NULL,
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 //------------------------------------------------------------------------------ 1314 //------------------------------------------------------------------------------
1304 1315
1305 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( 1316 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting(
1306 const blink::WebBatteryStatus& status) { 1317 const blink::WebBatteryStatus& status) {
1307 if (!g_test_battery_status_listener) 1318 if (!g_test_battery_status_listener)
1308 return; 1319 return;
1309 g_test_battery_status_listener->updateBatteryStatus(status); 1320 g_test_battery_status_listener->updateBatteryStatus(status);
1310 } 1321 }
1311 1322
1312 } // namespace content 1323 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698