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

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

Issue 2049003002: Wrap GCed raw pointer parameters of WTF::bind with Persistent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/ExecutionContextTask.h" 9 #include "core/dom/ExecutionContextTask.h"
10 #include "core/events/Event.h" 10 #include "core/events/Event.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 void Sensor::updateState(SensorState newState) 85 void Sensor::updateState(SensorState newState)
86 { 86 {
87 DCHECK(isMainThread()); 87 DCHECK(isMainThread());
88 if (m_sensorState == newState) 88 if (m_sensorState == newState)
89 return; 89 return;
90 90
91 m_sensorState = newState; 91 m_sensorState = newState;
92 // Notify context that state changed. 92 // Notify context that state changed.
93 if (getExecutionContext()) 93 if (getExecutionContext())
94 getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&S ensor::notifyStateChange, this)); 94 getExecutionContext()->postTask(BLINK_FROM_HERE, createSameThreadTask(&S ensor::notifyStateChange, wrapPersistent(this)));
95 } 95 }
96 96
97 void Sensor::notifyStateChange() 97 void Sensor::notifyStateChange()
98 { 98 {
99 dispatchEvent(Event::create(EventTypeNames::statechange)); 99 dispatchEvent(Event::create(EventTypeNames::statechange));
100 } 100 }
101 101
102 void Sensor::suspend() 102 void Sensor::suspend()
103 { 103 {
104 m_hasEventListener = false; 104 m_hasEventListener = false;
(...skipping 21 matching lines...) Expand all
126 126
127 DEFINE_TRACE(Sensor) 127 DEFINE_TRACE(Sensor)
128 { 128 {
129 ActiveDOMObject::trace(visitor); 129 ActiveDOMObject::trace(visitor);
130 EventTargetWithInlineData::trace(visitor); 130 EventTargetWithInlineData::trace(visitor);
131 PlatformEventController::trace(visitor); 131 PlatformEventController::trace(visitor);
132 visitor->trace(m_sensorReading); 132 visitor->trace(m_sensorReading);
133 } 133 }
134 134
135 } // namespace blink 135 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698