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

Side by Side Diff: Source/modules/device_orientation/DeviceMotionEvent.cpp

Issue 1113403002: This CL clean up patch in DeviceMotionEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 m_deviceMotionData = deviceMotionData; 56 m_deviceMotionData = deviceMotionData;
57 57
58 m_acceleration.clear(); 58 m_acceleration.clear();
59 m_accelerationIncludingGravity.clear(); 59 m_accelerationIncludingGravity.clear();
60 m_rotationRate.clear(); 60 m_rotationRate.clear();
61 } 61 }
62 62
63 DeviceAcceleration* DeviceMotionEvent::acceleration() 63 DeviceAcceleration* DeviceMotionEvent::acceleration()
64 { 64 {
65 if (!m_deviceMotionData->acceleration()) 65 if (!m_deviceMotionData->acceleration())
66 return 0; 66 return nullptr;
67 67
68 if (!m_acceleration) 68 if (!m_acceleration)
69 m_acceleration = DeviceAcceleration::create(m_deviceMotionData->accelera tion()); 69 m_acceleration = DeviceAcceleration::create(m_deviceMotionData->accelera tion());
70 70
71 return m_acceleration.get(); 71 return m_acceleration.get();
72 } 72 }
73 73
74 DeviceAcceleration* DeviceMotionEvent::accelerationIncludingGravity() 74 DeviceAcceleration* DeviceMotionEvent::accelerationIncludingGravity()
75 { 75 {
76 if (!m_deviceMotionData->accelerationIncludingGravity()) 76 if (!m_deviceMotionData->accelerationIncludingGravity())
77 return 0; 77 return nullptr;
78 78
79 if (!m_accelerationIncludingGravity) 79 if (!m_accelerationIncludingGravity)
80 m_accelerationIncludingGravity = DeviceAcceleration::create(m_deviceMoti onData->accelerationIncludingGravity()); 80 m_accelerationIncludingGravity = DeviceAcceleration::create(m_deviceMoti onData->accelerationIncludingGravity());
81 81
82 return m_accelerationIncludingGravity.get(); 82 return m_accelerationIncludingGravity.get();
83 } 83 }
84 84
85 DeviceRotationRate* DeviceMotionEvent::rotationRate() 85 DeviceRotationRate* DeviceMotionEvent::rotationRate()
86 { 86 {
87 if (!m_deviceMotionData->rotationRate()) 87 if (!m_deviceMotionData->rotationRate())
88 return 0; 88 return nullptr;
89 89
90 if (!m_rotationRate) 90 if (!m_rotationRate)
91 m_rotationRate = DeviceRotationRate::create(m_deviceMotionData->rotation Rate()); 91 m_rotationRate = DeviceRotationRate::create(m_deviceMotionData->rotation Rate());
92 92
93 return m_rotationRate.get(); 93 return m_rotationRate.get();
94 } 94 }
95 95
96 double DeviceMotionEvent::interval(bool& isNull) const 96 double DeviceMotionEvent::interval(bool& isNull) const
97 { 97 {
98 if (m_deviceMotionData->canProvideInterval()) 98 if (m_deviceMotionData->canProvideInterval())
(...skipping 11 matching lines...) Expand all
110 DEFINE_TRACE(DeviceMotionEvent) 110 DEFINE_TRACE(DeviceMotionEvent)
111 { 111 {
112 visitor->trace(m_deviceMotionData); 112 visitor->trace(m_deviceMotionData);
113 visitor->trace(m_acceleration); 113 visitor->trace(m_acceleration);
114 visitor->trace(m_accelerationIncludingGravity); 114 visitor->trace(m_accelerationIncludingGravity);
115 visitor->trace(m_rotationRate); 115 visitor->trace(m_rotationRate);
116 Event::trace(visitor); 116 Event::trace(visitor);
117 } 117 }
118 118
119 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698