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

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

Issue 2341043002: webgl: Replace query task observer with a posted task (Closed)
Patch Set: Use CancellableTaskFactory instead Created 4 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 #include "platform/scheduler/CancellableTaskFactory.h"
10 #include "public/platform/WebThread.h"
11 10
12 namespace gpu { 11 namespace gpu {
13 namespace gles2 { 12 namespace gles2 {
14 class GLES2Interface; 13 class GLES2Interface;
15 } 14 }
16 } 15 }
17 16
18 namespace blink { 17 namespace blink {
19 18
20 class WebGLTimerQueryEXT : public WebGLContextObject, public WebThread::TaskObse rver { 19 class WebTaskRunner;
20
21 class WebGLTimerQueryEXT : public WebGLContextObject {
21 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
22 23
23 public: 24 public:
24 static WebGLTimerQueryEXT* create(WebGLRenderingContextBase*); 25 static WebGLTimerQueryEXT* create(WebGLRenderingContextBase*);
25 ~WebGLTimerQueryEXT() override; 26 ~WebGLTimerQueryEXT() override;
26 27
27 void setTarget(GLenum target) { m_target = target; } 28 void setTarget(GLenum target) { m_target = target; }
28 29
29 GLuint object() const { return m_queryId; } 30 GLuint object() const { return m_queryId; }
30 bool hasTarget() const { return m_target != 0; } 31 bool hasTarget() const { return m_target != 0; }
31 GLenum target() const { return m_target; } 32 GLenum target() const { return m_target; }
32 33
33 void resetCachedResult(); 34 void resetCachedResult();
34 void updateCachedResult(gpu::gles2::GLES2Interface*); 35 void updateCachedResult(gpu::gles2::GLES2Interface*);
35 36
36 bool isQueryResultAvailable(); 37 bool isQueryResultAvailable();
37 GLuint64 getQueryResult(); 38 GLuint64 getQueryResult();
38 39
39 protected: 40 protected:
40 WebGLTimerQueryEXT(WebGLRenderingContextBase*); 41 WebGLTimerQueryEXT(WebGLRenderingContextBase*);
41 42
42 private: 43 private:
43 bool hasObject() const override { return m_queryId != 0; } 44 bool hasObject() const override { return m_queryId != 0; }
44 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; 45 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override;
45 46
46 void registerTaskObserver(); 47 void scheduleAllowAvailabilityUpdate();
47 void unregisterTaskObserver(); 48 void allowAvailabilityUpdate();
48
49 // TaskObserver implementation.
50 void didProcessTask() override;
51 void willProcessTask() override { }
52 49
53 GLenum m_target; 50 GLenum m_target;
54 GLuint m_queryId; 51 GLuint m_queryId;
55 52
56 bool m_taskObserverRegistered;
57 bool m_canUpdateAvailability; 53 bool m_canUpdateAvailability;
58 bool m_queryResultAvailable; 54 bool m_queryResultAvailable;
59 GLuint64 m_queryResult; 55 GLuint64 m_queryResult;
56
57 std::unique_ptr<WebTaskRunner> m_taskRunner;
58 std::unique_ptr<CancellableTaskFactory> m_cancellableTaskFactory;
60 }; 59 };
61 60
62 } // namespace blink 61 } // namespace blink
63 62
64 #endif // WebGLTimerQueryEXT_h 63 #endif // WebGLTimerQueryEXT_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp ('k') | third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698