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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "third_party/skia/include/images/SkImageEncoder.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFloatPoin
t.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
16 #include "third_party/skia/include/images/SkImageEncoder.h" | |
17 #include "ui/compositor/compositor_observer.h" | 17 #include "ui/compositor/compositor_observer.h" |
18 #include "ui/compositor/compositor_switches.h" | 18 #include "ui/compositor/compositor_switches.h" |
19 #include "ui/compositor/dip_util.h" | 19 #include "ui/compositor/dip_util.h" |
20 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
21 #include "ui/compositor/test_web_graphics_context_3d.h" | 21 #include "ui/compositor/test_web_graphics_context_3d.h" |
22 #include "ui/gl/gl_context.h" | 22 #include "ui/gl/gl_context.h" |
23 #include "ui/gl/gl_implementation.h" | 23 #include "ui/gl/gl_implementation.h" |
24 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
25 #include "webkit/glue/webthread_impl.h" | 25 #include "webkit/glue/webthread_impl.h" |
26 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" | 26 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" |
27 | 27 |
28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
29 #include "base/chromeos/chromeos_version.h" | 29 #include "base/chromeos/chromeos_version.h" |
30 #endif | 30 #endif |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const double kDefaultRefreshRate = 60.0; | 34 const double kDefaultRefreshRate = 60.0; |
35 const double kTestRefreshRate = 100.0; | 35 const double kTestRefreshRate = 100.0; |
36 | 36 |
37 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; | 37 webkit_glue::WebThreadImpl* g_compositor_thread = NULL; |
38 | 38 |
39 bool test_compositor_enabled = false; | 39 bool test_compositor_enabled = false; |
40 | 40 |
41 ui::ContextFactory* g_context_factory = NULL; | 41 ui::ContextFactory* g_context_factory = NULL; |
42 | 42 |
43 } // anonymous namespace | 43 } // namespace |
44 | 44 |
45 namespace ui { | 45 namespace ui { |
46 | 46 |
47 // static | 47 // static |
48 ContextFactory* ContextFactory::GetInstance() { | 48 ContextFactory* ContextFactory::GetInstance() { |
49 // We leak the shared resources so that we don't race with | 49 // We leak the shared resources so that we don't race with |
50 // the tear down of the gl_bindings. | 50 // the tear down of the gl_bindings. |
51 if (!g_context_factory) { | 51 if (!g_context_factory) { |
52 DVLOG(1) << "Using DefaultSharedResource"; | 52 DVLOG(1) << "Using DefaultSharedResource"; |
53 scoped_ptr<DefaultContextFactory> instance( | 53 scoped_ptr<DefaultContextFactory> instance( |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 COMPOSITOR_EXPORT void DisableTestCompositor() { | 426 COMPOSITOR_EXPORT void DisableTestCompositor() { |
427 test_compositor_enabled = false; | 427 test_compositor_enabled = false; |
428 } | 428 } |
429 | 429 |
430 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 430 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
431 return test_compositor_enabled; | 431 return test_compositor_enabled; |
432 } | 432 } |
433 | 433 |
434 } // namespace ui | 434 } // namespace ui |
OLD | NEW |