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

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

Issue 2870073002: [Sensors] Decouple sensor readings update from rAF (Closed)
Patch Set: [Sensors] Decouple sensor readings update from rAF Created 3 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
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/SensorProviderProxy.h" 5 #include "modules/sensor/SensorProviderProxy.h"
6 6
7 #include "modules/sensor/SensorProxy.h" 7 #include "modules/sensor/SensorProxy.h"
8 #include "platform/mojo/MojoHelper.h" 8 #include "platform/mojo/MojoHelper.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "services/device/public/interfaces/constants.mojom-blink.h" 10 #include "services/device/public/interfaces/constants.mojom-blink.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SensorProxy* sensor = new SensorProxy(type, this, page); 59 SensorProxy* sensor = new SensorProxy(type, this, page);
60 sensor_proxies_.insert(sensor); 60 sensor_proxies_.insert(sensor);
61 61
62 return sensor; 62 return sensor;
63 } 63 }
64 64
65 SensorProxy* SensorProviderProxy::GetSensorProxy( 65 SensorProxy* SensorProviderProxy::GetSensorProxy(
66 device::mojom::blink::SensorType type) { 66 device::mojom::blink::SensorType type) {
67 for (SensorProxy* sensor : sensor_proxies_) { 67 for (SensorProxy* sensor : sensor_proxies_) {
68 // TODO(Mikhail) : Hash sensors by type for efficiency. 68 // TODO(Mikhail) : Hash sensors by type for efficiency.
69 if (sensor->GetType() == type) 69 if (sensor->type() == type)
70 return sensor; 70 return sensor;
71 } 71 }
72 72
73 return nullptr; 73 return nullptr;
74 } 74 }
75 75
76 void SensorProviderProxy::OnSensorProviderConnectionError() { 76 void SensorProviderProxy::OnSensorProviderConnectionError() {
77 sensor_provider_.reset(); 77 sensor_provider_.reset();
78 for (SensorProxy* sensor : sensor_proxies_) 78 for (SensorProxy* sensor : sensor_proxies_)
79 sensor->HandleSensorError(); 79 sensor->HandleSensorError();
80 } 80 }
81 81
82 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698