summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 00:51:40 +0000
committerajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 00:51:40 +0000
commit6440ee144b4a4e9207fbe1f17745846b5e1305d2 (patch)
tree82ce9dbaf589582729f94c0235ca3958b3e4bd4f /webkit
parent06e0258c243a0a9ab076d480020fa62af29885bc (diff)
downloadchromium_src-6440ee144b4a4e9207fbe1f17745846b5e1305d2.zip
chromium_src-6440ee144b4a4e9207fbe1f17745846b5e1305d2.tar.gz
chromium_src-6440ee144b4a4e9207fbe1f17745846b5e1305d2.tar.bz2
Move id generation from WebAnimationImpl to WebAnimationIdProvider
This allows animations created outside of WebAnimationImpl to use animation ids and group ids that do not conflict with those used by WebAnimationImpl. This change is needed for threading ui animations. BUG=164206 Review URL: https://chromiumcodereview.appspot.com/11574046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/compositor_bindings/compositor_bindings.gyp2
-rw-r--r--webkit/compositor_bindings/web_animation_id_provider.cc19
-rw-r--r--webkit/compositor_bindings/web_animation_id_provider.h19
-rw-r--r--webkit/compositor_bindings/web_animation_impl.cc8
4 files changed, 44 insertions, 4 deletions
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp
index d122687..e4df060 100644
--- a/webkit/compositor_bindings/compositor_bindings.gyp
+++ b/webkit/compositor_bindings/compositor_bindings.gyp
@@ -7,6 +7,8 @@
'webkit_compositor_bindings_sources': [
'web_animation_curve_common.cc',
'web_animation_curve_common.h',
+ 'web_animation_id_provider.cc',
+ 'web_animation_id_provider.h',
'web_animation_impl.cc',
'web_animation_impl.h',
'web_compositor_support_output_surface.cc',
diff --git a/webkit/compositor_bindings/web_animation_id_provider.cc b/webkit/compositor_bindings/web_animation_id_provider.cc
new file mode 100644
index 0000000..efd3f0f
--- /dev/null
+++ b/webkit/compositor_bindings/web_animation_id_provider.cc
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 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 "webkit/compositor_bindings/web_animation_id_provider.h"
+
+namespace webkit {
+
+int WebAnimationIdProvider::NextAnimationId() {
+ static int next_animation_id = 1;
+ return next_animation_id++;
+}
+
+int WebAnimationIdProvider::NextGroupId() {
+ static int next_group_id = 1;
+ return next_group_id++;
+}
+
+} // namespace webkit
diff --git a/webkit/compositor_bindings/web_animation_id_provider.h b/webkit/compositor_bindings/web_animation_id_provider.h
new file mode 100644
index 0000000..631785c
--- /dev/null
+++ b/webkit/compositor_bindings/web_animation_id_provider.h
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 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.
+
+#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_ANIMATION_ID_PROVIDER
+#define WEBKIT_COMPOSITOR_BINDINGS_WEB_ANIMATION_ID_PROVIDER
+
+namespace webkit {
+
+class WebAnimationIdProvider {
+ public:
+ // These functions each return monotonically increasing values.
+ static int NextAnimationId();
+ static int NextGroupId();
+};
+
+}
+
+#endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_ANIMATION_ID_PROVIDER
diff --git a/webkit/compositor_bindings/web_animation_impl.cc b/webkit/compositor_bindings/web_animation_impl.cc
index 0e156fa..a4948ae 100644
--- a/webkit/compositor_bindings/web_animation_impl.cc
+++ b/webkit/compositor_bindings/web_animation_impl.cc
@@ -8,10 +8,12 @@
#include "cc/animation_curve.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationCurve.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h"
+#include "web_animation_id_provider.h"
#include "web_float_animation_curve_impl.h"
#include "web_transform_animation_curve_impl.h"
using cc::ActiveAnimation;
+using webkit::WebAnimationIdProvider;
namespace WebKit {
@@ -22,12 +24,10 @@ WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert
WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProperty targetProperty, int animationId, int groupId)
{
- static int nextAnimationId = 1;
- static int nextGroupId = 1;
if (!animationId)
- animationId = nextAnimationId++;
+ animationId = WebAnimationIdProvider::NextAnimationId();
if (!groupId)
- groupId = nextGroupId++;
+ groupId = WebAnimationIdProvider::NextGroupId();
WebAnimationCurve::AnimationCurveType curveType = webCurve.type();
scoped_ptr<cc::AnimationCurve> curve;