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

Side by Side Diff: cc/animation/animation.cc

Issue 804373004: replace COMPILE_ASSERT with static_assert in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | cc/base/util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include "cc/animation/animation.h" 5 #include "cc/animation/animation.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "cc/animation/animation_curve.h" 11 #include "cc/animation/animation_curve.h"
12 #include "cc/base/time_util.h" 12 #include "cc/base/time_util.h"
13 13
14 namespace { 14 namespace {
15 15
16 // This should match the RunState enum. 16 // This should match the RunState enum.
17 static const char* const s_runStateNames[] = { 17 static const char* const s_runStateNames[] = {
18 "WaitingForTargetAvailability", 18 "WaitingForTargetAvailability",
19 "WaitingForDeletion", 19 "WaitingForDeletion",
20 "Starting", 20 "Starting",
21 "Running", 21 "Running",
22 "Paused", 22 "Paused",
23 "Finished", 23 "Finished",
24 "Aborted" 24 "Aborted"
25 }; 25 };
26 26
27 COMPILE_ASSERT(static_cast<int>(cc::Animation::RunStateEnumSize) == 27 static_assert(static_cast<int>(cc::Animation::RunStateEnumSize) ==
28 arraysize(s_runStateNames), 28 arraysize(s_runStateNames),
29 RunState_names_match_enum); 29 "RunStateEnumSize should equal the number of elements in "
30 "s_runStateNames");
30 31
31 // This should match the TargetProperty enum. 32 // This should match the TargetProperty enum.
32 static const char* const s_targetPropertyNames[] = { 33 static const char* const s_targetPropertyNames[] = {
33 "Transform", 34 "Transform",
34 "Opacity", 35 "Opacity",
35 "Filter", 36 "Filter",
36 "ScrollOffset", 37 "ScrollOffset",
37 "BackgroundColor" 38 "BackgroundColor"
38 }; 39 };
39 40
40 COMPILE_ASSERT(static_cast<int>(cc::Animation::TargetPropertyEnumSize) == 41 static_assert(static_cast<int>(cc::Animation::TargetPropertyEnumSize) ==
41 arraysize(s_targetPropertyNames), 42 arraysize(s_targetPropertyNames),
42 TargetProperty_names_match_enum); 43 "TargetPropertyEnumSize should equal the number of elements in "
44 "s_targetPropertyNames");
43 45
44 } // namespace 46 } // namespace
45 47
46 namespace cc { 48 namespace cc {
47 49
48 scoped_ptr<Animation> Animation::Create( 50 scoped_ptr<Animation> Animation::Create(
49 scoped_ptr<AnimationCurve> curve, 51 scoped_ptr<AnimationCurve> curve,
50 int animation_id, 52 int animation_id,
51 int group_id, 53 int group_id,
52 TargetProperty target_property) { 54 TargetProperty target_property) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // the main thread. 282 // the main thread.
281 if (run_state_ == Animation::Paused || 283 if (run_state_ == Animation::Paused ||
282 other->run_state_ == Animation::Paused) { 284 other->run_state_ == Animation::Paused) {
283 other->run_state_ = run_state_; 285 other->run_state_ = run_state_;
284 other->pause_time_ = pause_time_; 286 other->pause_time_ = pause_time_;
285 other->total_paused_time_ = total_paused_time_; 287 other->total_paused_time_ = total_paused_time_;
286 } 288 }
287 } 289 }
288 290
289 } // namespace cc 291 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/base/util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698