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

Side by Side Diff: ui/gl/gl_surface_glx.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « ui/gl/gl_surface_glx.h ('k') | ui/gl/gl_surface_win.cc » ('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 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
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #endif 70 #endif
71 71
72 class OMLSyncControlVSyncProvider 72 class OMLSyncControlVSyncProvider
73 : public gfx::SyncControlVSyncProvider { 73 : public gfx::SyncControlVSyncProvider {
74 public: 74 public:
75 explicit OMLSyncControlVSyncProvider(gfx::AcceleratedWidget window) 75 explicit OMLSyncControlVSyncProvider(gfx::AcceleratedWidget window)
76 : SyncControlVSyncProvider(), 76 : SyncControlVSyncProvider(),
77 window_(window) { 77 window_(window) {
78 } 78 }
79 79
80 virtual ~OMLSyncControlVSyncProvider() { } 80 ~OMLSyncControlVSyncProvider() override {}
81 81
82 protected: 82 protected:
83 virtual bool GetSyncValues(int64* system_time, 83 bool GetSyncValues(int64* system_time,
84 int64* media_stream_counter, 84 int64* media_stream_counter,
85 int64* swap_buffer_counter) override { 85 int64* swap_buffer_counter) override {
86 return glXGetSyncValuesOML(g_display, window_, system_time, 86 return glXGetSyncValuesOML(g_display, window_, system_time,
87 media_stream_counter, swap_buffer_counter); 87 media_stream_counter, swap_buffer_counter);
88 } 88 }
89 89
90 virtual bool GetMscRate(int32* numerator, int32* denominator) override { 90 bool GetMscRate(int32* numerator, int32* denominator) override {
91 if (!g_glx_get_msc_rate_oml_supported) 91 if (!g_glx_get_msc_rate_oml_supported)
92 return false; 92 return false;
93 93
94 if (!glXGetMscRateOML(g_display, window_, numerator, denominator)) { 94 if (!glXGetMscRateOML(g_display, window_, numerator, denominator)) {
95 // Once glXGetMscRateOML has been found to fail, don't try again, 95 // Once glXGetMscRateOML has been found to fail, don't try again,
96 // since each failing call may spew an error message. 96 // since each failing call may spew an error message.
97 g_glx_get_msc_rate_oml_supported = false; 97 g_glx_get_msc_rate_oml_supported = false;
98 return false; 98 return false;
99 } 99 }
100 100
(...skipping 19 matching lines...) Expand all
120 return g_video_sync_thread; 120 return g_video_sync_thread;
121 } 121 }
122 122
123 private: 123 private:
124 friend class base::RefCounted<SGIVideoSyncThread>; 124 friend class base::RefCounted<SGIVideoSyncThread>;
125 125
126 SGIVideoSyncThread() : base::Thread("SGI_video_sync") { 126 SGIVideoSyncThread() : base::Thread("SGI_video_sync") {
127 DCHECK(CalledOnValidThread()); 127 DCHECK(CalledOnValidThread());
128 } 128 }
129 129
130 virtual ~SGIVideoSyncThread() { 130 ~SGIVideoSyncThread() override {
131 DCHECK(CalledOnValidThread()); 131 DCHECK(CalledOnValidThread());
132 g_video_sync_thread = NULL; 132 g_video_sync_thread = NULL;
133 Stop(); 133 Stop();
134 } 134 }
135 135
136 static SGIVideoSyncThread* g_video_sync_thread; 136 static SGIVideoSyncThread* g_video_sync_thread;
137 137
138 DISALLOW_COPY_AND_ASSIGN(SGIVideoSyncThread); 138 DISALLOW_COPY_AND_ASSIGN(SGIVideoSyncThread);
139 }; 139 };
140 140
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 : vsync_thread_(SGIVideoSyncThread::Create()), 249 : vsync_thread_(SGIVideoSyncThread::Create()),
250 shim_(new SGIVideoSyncProviderThreadShim(window)), 250 shim_(new SGIVideoSyncProviderThreadShim(window)),
251 cancel_vsync_flag_(shim_->cancel_vsync_flag()), 251 cancel_vsync_flag_(shim_->cancel_vsync_flag()),
252 vsync_lock_(shim_->vsync_lock()) { 252 vsync_lock_(shim_->vsync_lock()) {
253 vsync_thread_->message_loop()->PostTask( 253 vsync_thread_->message_loop()->PostTask(
254 FROM_HERE, 254 FROM_HERE,
255 base::Bind(&SGIVideoSyncProviderThreadShim::Initialize, 255 base::Bind(&SGIVideoSyncProviderThreadShim::Initialize,
256 base::Unretained(shim_.get()))); 256 base::Unretained(shim_.get())));
257 } 257 }
258 258
259 virtual ~SGIVideoSyncVSyncProvider() { 259 ~SGIVideoSyncVSyncProvider() override {
260 { 260 {
261 base::AutoLock locked(*vsync_lock_); 261 base::AutoLock locked(*vsync_lock_);
262 cancel_vsync_flag_->Set(); 262 cancel_vsync_flag_->Set();
263 } 263 }
264 264
265 // Hand-off |shim_| to be deleted on the |vsync_thread_|. 265 // Hand-off |shim_| to be deleted on the |vsync_thread_|.
266 vsync_thread_->message_loop()->DeleteSoon( 266 vsync_thread_->message_loop()->DeleteSoon(
267 FROM_HERE, 267 FROM_HERE,
268 shim_.release()); 268 shim_.release());
269 } 269 }
270 270
271 virtual void GetVSyncParameters( 271 void GetVSyncParameters(
272 const VSyncProvider::UpdateVSyncCallback& callback) override { 272 const VSyncProvider::UpdateVSyncCallback& callback) override {
273 if (kGetVSyncParametersMinPeriod > base::TimeDelta()) { 273 if (kGetVSyncParametersMinPeriod > base::TimeDelta()) {
274 base::TimeTicks now = base::TimeTicks::Now(); 274 base::TimeTicks now = base::TimeTicks::Now();
275 base::TimeDelta delta = now - last_get_vsync_parameters_time_; 275 base::TimeDelta delta = now - last_get_vsync_parameters_time_;
276 if (delta < kGetVSyncParametersMinPeriod) 276 if (delta < kGetVSyncParametersMinPeriod)
277 return; 277 return;
278 last_get_vsync_parameters_time_ = now; 278 last_get_vsync_parameters_time_ = now;
279 } 279 }
280 280
281 // Only one outstanding request per surface. 281 // Only one outstanding request per surface.
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 689
690 void* PbufferGLSurfaceGLX::GetConfig() { 690 void* PbufferGLSurfaceGLX::GetConfig() {
691 return config_; 691 return config_;
692 } 692 }
693 693
694 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() { 694 PbufferGLSurfaceGLX::~PbufferGLSurfaceGLX() {
695 Destroy(); 695 Destroy();
696 } 696 }
697 697
698 } // namespace gfx 698 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_glx.h ('k') | ui/gl/gl_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698