[chromedriver] Disable ChromeDriverTest.testShouldHandleNewWindowLoadingProperly.
[chromium-blink-merge.git] / ui / gl / gl_fence_nv.cc
blob0e23b283458fd71c0404e5806403c79003a15c08
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gl/gl_fence_nv.h"
7 #include "ui/gl/gl_bindings.h"
9 namespace gfx {
11 GLFenceNV::GLFenceNV() {
12 // What if either of these GL calls fails? TestFenceNV will return true.
13 // See spec:
14 // http://www.opengl.org/registry/specs/NV/fence.txt
16 // What should happen if TestFenceNV is called for a name before SetFenceNV
17 // is called?
18 // We generate an INVALID_OPERATION error, and return TRUE.
19 // This follows the semantics for texture object names before
20 // they are bound, in that they acquire their state upon binding.
21 // We will arbitrarily return TRUE for consistency.
22 glGenFencesNV(1, &fence_);
23 glSetFenceNV(fence_, GL_ALL_COMPLETED_NV);
24 DCHECK(glIsFenceNV(fence_));
25 glFlush();
28 bool GLFenceNV::HasCompleted() {
29 DCHECK(glIsFenceNV(fence_));
30 return !!glTestFenceNV(fence_);
33 void GLFenceNV::ClientWait() {
34 DCHECK(glIsFenceNV(fence_));
35 glFinishFenceNV(fence_);
38 void GLFenceNV::ServerWait() {
39 DCHECK(glIsFenceNV(fence_));
40 ClientWait();
43 GLFenceNV::~GLFenceNV() {
44 DCHECK(glIsFenceNV(fence_));
45 glDeleteFencesNV(1, &fence_);
48 } // namespace gfx