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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.h

Issue 1385793002: Only make timer queries' results available when control returns to browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review feedback from dyen. Created 5 years, 2 months 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef WebGLTimerQueryEXT_h 5 #ifndef WebGLTimerQueryEXT_h
6 #define WebGLTimerQueryEXT_h 6 #define WebGLTimerQueryEXT_h
7 7
8 #include "modules/webgl/WebGLContextObject.h" 8 #include "modules/webgl/WebGLContextObject.h"
9 9
10 #include "public/platform/WebThread.h"
11
10 namespace blink { 12 namespace blink {
11 13
12 class WebGLTimerQueryEXT : public WebGLContextObject { 14 class WebGLTimerQueryEXT : public WebGLContextObject, public WebThread::TaskObse rver {
13 DEFINE_WRAPPERTYPEINFO(); 15 DEFINE_WRAPPERTYPEINFO();
14 16
15 public: 17 public:
16 static WebGLTimerQueryEXT* create(WebGLRenderingContextBase*); 18 static WebGLTimerQueryEXT* create(WebGLRenderingContextBase*);
17 ~WebGLTimerQueryEXT() override; 19 ~WebGLTimerQueryEXT() override;
18 20
19 void setTarget(GLenum target) { m_target = target; } 21 void setTarget(GLenum target) { m_target = target; }
20 22
21 GLuint object() const { return m_queryId; } 23 GLuint object() const { return m_queryId; }
22 bool hasTarget() const { return m_target != 0; } 24 bool hasTarget() const { return m_target != 0; }
23 GLenum target() const { return m_target; } 25 GLenum target() const { return m_target; }
24 26
27 void resetCachedResult();
28 void updateCachedResult(WebGraphicsContext3D*);
29
30 bool isQueryResultAvailable();
31 GLuint64 getQueryResult();
32
25 protected: 33 protected:
26 WebGLTimerQueryEXT(WebGLRenderingContextBase*); 34 WebGLTimerQueryEXT(WebGLRenderingContextBase*);
27 35
28 private: 36 private:
29 bool hasObject() const override { return m_queryId != 0; } 37 bool hasObject() const override { return m_queryId != 0; }
30 void deleteObjectImpl(WebGraphicsContext3D*) override; 38 void deleteObjectImpl(WebGraphicsContext3D*) override;
31 39
40 void registerTaskObserver();
41 void unregisterTaskObserver();
42
43 // TaskObserver implementation.
44 void didProcessTask() override;
45 void willProcessTask() override { }
46
32 GLenum m_target; 47 GLenum m_target;
33 GLuint m_queryId; 48 GLuint m_queryId;
49
50 bool m_taskObserverRegistered;
51 bool m_canUpdateAvailability;
52 bool m_queryResultAvailable;
53 GLuint64 m_queryResult;
34 }; 54 };
35 55
36 } // namespace blink 56 } // namespace blink
37 57
38 #endif // WebGLTimerQueryEXT_h 58 #endif // WebGLTimerQueryEXT_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698