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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/Sensor.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "modules/sensor/Sensor.h" 5 #include "modules/sensor/Sensor.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/TaskRunnerHelper.h" 9 #include "core/dom/TaskRunnerHelper.h"
10 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (newState == m_state) 272 if (newState == m_state)
273 return; 273 return;
274 274
275 if (newState == SensorState::Activated && getExecutionContext()) { 275 if (newState == SensorState::Activated && getExecutionContext()) {
276 DCHECK_EQ(SensorState::Activating, m_state); 276 DCHECK_EQ(SensorState::Activating, m_state);
277 // The initial value for m_lastUpdateTimestamp is set to current time, 277 // The initial value for m_lastUpdateTimestamp is set to current time,
278 // so that the first reading update will be notified considering the given 278 // so that the first reading update will be notified considering the given
279 // frequency hint. 279 // frequency hint.
280 m_lastUpdateTimestamp = WTF::monotonicallyIncreasingTime(); 280 m_lastUpdateTimestamp = WTF::monotonicallyIncreasingTime();
281 TaskRunnerHelper::get(TaskType::Sensor, getExecutionContext()) 281 TaskRunnerHelper::get(TaskType::Sensor, getExecutionContext())
282 ->postTask(BLINK_FROM_HERE, WTF::bind(&Sensor::notifyOnActivate, 282 ->postTask(
283 wrapWeakPersistent(this))); 283 BLINK_FROM_HERE,
284 WTF::bind(&Sensor::notifyOnActivate, wrapWeakPersistent(this)));
284 } 285 }
285 286
286 m_state = newState; 287 m_state = newState;
287 } 288 }
288 289
289 void Sensor::reportError(ExceptionCode code, 290 void Sensor::reportError(ExceptionCode code,
290 const String& sanitizedMessage, 291 const String& sanitizedMessage,
291 const String& unsanitizedMessage) { 292 const String& unsanitizedMessage) {
292 updateState(Sensor::SensorState::Errored); 293 updateState(Sensor::SensorState::Errored);
293 if (getExecutionContext()) { 294 if (getExecutionContext()) {
(...skipping 25 matching lines...) Expand all
319 } 320 }
320 321
321 bool Sensor::canReturnReadings() const { 322 bool Sensor::canReturnReadings() const {
322 if (m_state != Sensor::SensorState::Activated) 323 if (m_state != Sensor::SensorState::Activated)
323 return false; 324 return false;
324 DCHECK(m_sensorProxy); 325 DCHECK(m_sensorProxy);
325 return m_sensorProxy->reading().timestamp != 0.0; 326 return m_sensorProxy->reading().timestamp != 0.0;
326 } 327 }
327 328
328 } // namespace blink 329 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698