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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/sys_info.h" |
17 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
18 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
19 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
20 #include "cc/debug/test_context_provider.h" | 21 #include "cc/debug/test_context_provider.h" |
21 #include "cc/debug/test_web_graphics_context_3d.h" | 22 #include "cc/debug/test_web_graphics_context_3d.h" |
22 #include "cc/input/input_handler.h" | 23 #include "cc/input/input_handler.h" |
23 #include "cc/layers/layer.h" | 24 #include "cc/layers/layer.h" |
24 #include "cc/output/context_provider.h" | 25 #include "cc/output/context_provider.h" |
25 #include "cc/output/output_surface.h" | 26 #include "cc/output/output_surface.h" |
26 #include "cc/trees/layer_tree_host.h" | 27 #include "cc/trees/layer_tree_host.h" |
27 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
28 #include "ui/compositor/compositor_observer.h" | 29 #include "ui/compositor/compositor_observer.h" |
29 #include "ui/compositor/compositor_switches.h" | 30 #include "ui/compositor/compositor_switches.h" |
30 #include "ui/compositor/dip_util.h" | 31 #include "ui/compositor/dip_util.h" |
31 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
32 #include "ui/compositor/reflector.h" | 33 #include "ui/compositor/reflector.h" |
33 #include "ui/gl/gl_context.h" | 34 #include "ui/gl/gl_context.h" |
34 #include "ui/gl/gl_implementation.h" | 35 #include "ui/gl/gl_implementation.h" |
35 #include "ui/gl/gl_surface.h" | 36 #include "ui/gl/gl_surface.h" |
36 #include "ui/gl/gl_switches.h" | 37 #include "ui/gl/gl_switches.h" |
37 #include "webkit/common/gpu/context_provider_in_process.h" | 38 #include "webkit/common/gpu/context_provider_in_process.h" |
38 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 39 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
39 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 40 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
40 | 41 |
41 #if defined(OS_CHROMEOS) | |
42 #include "base/chromeos/chromeos_version.h" | |
43 #endif | |
44 | |
45 namespace { | 42 namespace { |
46 | 43 |
47 const double kDefaultRefreshRate = 60.0; | 44 const double kDefaultRefreshRate = 60.0; |
48 const double kTestRefreshRate = 200.0; | 45 const double kTestRefreshRate = 200.0; |
49 | 46 |
50 enum SwapType { | 47 enum SwapType { |
51 DRAW_SWAP, | 48 DRAW_SWAP, |
52 READPIXELS_SWAP, | 49 READPIXELS_SWAP, |
53 }; | 50 }; |
54 | 51 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 bool use_test_contexts = true; | 450 bool use_test_contexts = true; |
454 | 451 |
455 // Always use test contexts unless the disable command line flag is used. | 452 // Always use test contexts unless the disable command line flag is used. |
456 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 453 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
457 if (command_line->HasSwitch(switches::kDisableTestCompositor)) | 454 if (command_line->HasSwitch(switches::kDisableTestCompositor)) |
458 use_test_contexts = false; | 455 use_test_contexts = false; |
459 | 456 |
460 #if defined(OS_CHROMEOS) | 457 #if defined(OS_CHROMEOS) |
461 // If the test is running on the chromeos envrionment (such as | 458 // If the test is running on the chromeos envrionment (such as |
462 // device or vm bots), always use real contexts. | 459 // device or vm bots), always use real contexts. |
463 if (base::chromeos::IsRunningOnChromeOS()) | 460 if (base::SysInfo::IsRunningOnChromeOS()) |
464 use_test_contexts = false; | 461 use_test_contexts = false; |
465 #endif | 462 #endif |
466 | 463 |
467 if (!allow_test_contexts) | 464 if (!allow_test_contexts) |
468 use_test_contexts = false; | 465 use_test_contexts = false; |
469 | 466 |
470 if (use_test_contexts) { | 467 if (use_test_contexts) { |
471 g_implicit_factory = new ui::TestContextFactory; | 468 g_implicit_factory = new ui::TestContextFactory; |
472 } else { | 469 } else { |
473 DVLOG(1) << "Using DefaultContextFactory"; | 470 DVLOG(1) << "Using DefaultContextFactory"; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 781 } |
785 | 782 |
786 void Compositor::NotifyEnd() { | 783 void Compositor::NotifyEnd() { |
787 last_ended_frame_++; | 784 last_ended_frame_++; |
788 FOR_EACH_OBSERVER(CompositorObserver, | 785 FOR_EACH_OBSERVER(CompositorObserver, |
789 observer_list_, | 786 observer_list_, |
790 OnCompositingEnded(this)); | 787 OnCompositingEnded(this)); |
791 } | 788 } |
792 | 789 |
793 } // namespace ui | 790 } // namespace ui |
OLD | NEW |