OLD | NEW |
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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 switches::kUIDisableThreadedCompositing); | 484 switches::kUIDisableThreadedCompositing); |
485 #else | 485 #else |
486 bool use_thread = | 486 bool use_thread = |
487 CommandLine::ForCurrentProcess()->HasSwitch( | 487 CommandLine::ForCurrentProcess()->HasSwitch( |
488 switches::kUIEnableThreadedCompositing) && | 488 switches::kUIEnableThreadedCompositing) && |
489 !CommandLine::ForCurrentProcess()->HasSwitch( | 489 !CommandLine::ForCurrentProcess()->HasSwitch( |
490 switches::kUIDisableThreadedCompositing); | 490 switches::kUIDisableThreadedCompositing); |
491 #endif | 491 #endif |
492 if (use_thread) { | 492 if (use_thread) { |
493 g_compositor_thread = new base::Thread("Browser Compositor"); | 493 g_compositor_thread = new base::Thread("Browser Compositor"); |
| 494 #if defined(OS_POSIX) |
| 495 // Workaround for crbug.com/293736 |
| 496 // On Posix, MessagePumpDefault uses system time, so delayed tasks (for |
| 497 // compositor scheduling) work incorrectly across system time changes (e.g. |
| 498 // tlsdate). So instead, use an IO loop, which uses libevent, that uses |
| 499 // monotonic time (immune to these problems). |
| 500 base::Thread::Options options; |
| 501 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 502 g_compositor_thread->StartWithOptions(options); |
| 503 #else |
494 g_compositor_thread->Start(); | 504 g_compositor_thread->Start(); |
| 505 #endif |
495 } | 506 } |
496 | 507 |
497 DCHECK(!g_compositor_initialized) << "Compositor initialized twice."; | 508 DCHECK(!g_compositor_initialized) << "Compositor initialized twice."; |
498 g_compositor_initialized = true; | 509 g_compositor_initialized = true; |
499 } | 510 } |
500 | 511 |
501 // static | 512 // static |
502 bool Compositor::WasInitializedWithThread() { | 513 bool Compositor::WasInitializedWithThread() { |
503 return !!g_compositor_thread; | 514 return !!g_compositor_thread; |
504 } | 515 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 } | 782 } |
772 | 783 |
773 void Compositor::NotifyEnd() { | 784 void Compositor::NotifyEnd() { |
774 last_ended_frame_++; | 785 last_ended_frame_++; |
775 FOR_EACH_OBSERVER(CompositorObserver, | 786 FOR_EACH_OBSERVER(CompositorObserver, |
776 observer_list_, | 787 observer_list_, |
777 OnCompositingEnded(this)); | 788 OnCompositingEnded(this)); |
778 } | 789 } |
779 | 790 |
780 } // namespace ui | 791 } // namespace ui |
OLD | NEW |