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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gl/gl_surface_glx.h" | 9 #include "ui/gl/gl_surface_glx.h" |
10 | 10 |
11 #include "base/basictypes.h" | |
12 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/synchronization/cancellation_flag.h" | 18 #include "base/synchronization/cancellation_flag.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
21 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
23 #include "base/time/time.h" | 23 #include "base/time/time.h" |
24 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 25 #include "build/build_config.h" |
25 #include "ui/events/platform/platform_event_source.h" | 26 #include "ui/events/platform/platform_event_source.h" |
26 #include "ui/gfx/x/x11_connection.h" | 27 #include "ui/gfx/x/x11_connection.h" |
27 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
28 #include "ui/gl/gl_bindings.h" | 29 #include "ui/gl/gl_bindings.h" |
29 #include "ui/gl/gl_implementation.h" | 30 #include "ui/gl/gl_implementation.h" |
30 #include "ui/gl/sync_control_vsync_provider.h" | 31 #include "ui/gl/sync_control_vsync_provider.h" |
31 | 32 |
32 namespace gfx { | 33 namespace gfx { |
33 | 34 |
34 namespace { | 35 namespace { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 : public gfx::SyncControlVSyncProvider { | 119 : public gfx::SyncControlVSyncProvider { |
119 public: | 120 public: |
120 explicit OMLSyncControlVSyncProvider(GLXWindow glx_window) | 121 explicit OMLSyncControlVSyncProvider(GLXWindow glx_window) |
121 : SyncControlVSyncProvider(), | 122 : SyncControlVSyncProvider(), |
122 glx_window_(glx_window) { | 123 glx_window_(glx_window) { |
123 } | 124 } |
124 | 125 |
125 ~OMLSyncControlVSyncProvider() override {} | 126 ~OMLSyncControlVSyncProvider() override {} |
126 | 127 |
127 protected: | 128 protected: |
128 bool GetSyncValues(int64* system_time, | 129 bool GetSyncValues(int64_t* system_time, |
129 int64* media_stream_counter, | 130 int64_t* media_stream_counter, |
130 int64* swap_buffer_counter) override { | 131 int64_t* swap_buffer_counter) override { |
131 return glXGetSyncValuesOML(g_display, glx_window_, system_time, | 132 return glXGetSyncValuesOML(g_display, glx_window_, system_time, |
132 media_stream_counter, swap_buffer_counter); | 133 media_stream_counter, swap_buffer_counter); |
133 } | 134 } |
134 | 135 |
135 bool GetMscRate(int32* numerator, int32* denominator) override { | 136 bool GetMscRate(int32_t* numerator, int32_t* denominator) override { |
136 if (!g_glx_get_msc_rate_oml_supported) | 137 if (!g_glx_get_msc_rate_oml_supported) |
137 return false; | 138 return false; |
138 | 139 |
139 if (!glXGetMscRateOML(g_display, glx_window_, numerator, denominator)) { | 140 if (!glXGetMscRateOML(g_display, glx_window_, numerator, denominator)) { |
140 // Once glXGetMscRateOML has been found to fail, don't try again, | 141 // Once glXGetMscRateOML has been found to fail, don't try again, |
141 // since each failing call may spew an error message. | 142 // since each failing call may spew an error message. |
142 g_glx_get_msc_rate_oml_supported = false; | 143 g_glx_get_msc_rate_oml_supported = false; |
143 return false; | 144 return false; |
144 } | 145 } |
145 | 146 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 if (!config_) | 639 if (!config_) |
639 config_ = GetConfigForWindow(g_display, window_); | 640 config_ = GetConfigForWindow(g_display, window_); |
640 return config_; | 641 return config_; |
641 } | 642 } |
642 | 643 |
643 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { | 644 UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() { |
644 Destroy(); | 645 Destroy(); |
645 } | 646 } |
646 | 647 |
647 } // namespace gfx | 648 } // namespace gfx |
OLD | NEW |