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

Unified Diff: cc/resources/sync_point_helper.cc

Issue 14126014: Add signalSyncPoint to the WebGraphicsContext3D command buffer impls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/sync_point_helper.cc
diff --git a/cc/resources/sync_point_helper.cc b/cc/resources/sync_point_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d964bb4c8ac296a06dbfc0aafb0570ff29ded7b5
--- /dev/null
+++ b/cc/resources/sync_point_helper.cc
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/resources/sync_point_helper.h"
+
+#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
+
+namespace cc {
+
+class SignalSyncPointCallbackClass
+ : public WebKit::WebGraphicsContext3D::WebGraphicsSyncPointCallback {
+ public:
+ SignalSyncPointCallbackClass(const base::Closure& closure)
piman 2013/04/26 01:20:52 nit: explicit
+ : closure_(closure) {}
piman 2013/04/26 01:20:52 nit: indent (':' at +4)
+
+ virtual void onSyncPointReached() {
+ if (!closure_.is_null())
+ closure_.Run();
+ }
+
+ private:
+ base::Closure closure_;
+};
+
+scoped_ptr<SyncPointHelper> SyncPointHelper::SignalSyncPoint(
+ WebKit::WebGraphicsContext3D* context3d,
+ unsigned sync_point,
+ const base::Closure& closure) {
+ scoped_ptr<SignalSyncPointCallbackClass> callback_class(
+ new SignalSyncPointCallbackClass(closure));
+
+ // Give a pointer to the CallbackClass to WebGraphicsContext3D.
+ context3d->signalSyncPoint(sync_point, callback_class.get());
+
+ // Store the ownership of the CallbackClass inside a SyncPointHelper and
+ // return it.
+ scoped_ptr<SyncPointHelper> helper(
+ new SyncPointHelper(callback_class.Pass()));
+ return helper.Pass();
+}
+
+SyncPointHelper::SyncPointHelper(
+ scoped_ptr<SignalSyncPointCallbackClass> callback_class)
+ : callback_class_(callback_class.Pass()) {}
+
+SyncPointHelper::~SyncPointHelper() {}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698