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

Side by Side Diff: device/generic_sensor/sensor_impl.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 | « device/generic_sensor/sensor_impl.h ('k') | device/generic_sensor/sensor_provider_impl.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 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 "device/generic_sensor/sensor_impl.h" 5 #include "device/generic_sensor/sensor_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "mojo/public/cpp/bindings/strong_binding.h"
10
9 namespace device { 11 namespace device {
10 12
11 SensorImpl::SensorImpl(mojo::InterfaceRequest<Sensor> request, 13 SensorImpl::SensorImpl(scoped_refptr<PlatformSensor> sensor)
12 scoped_refptr<PlatformSensor> sensor) 14 : sensor_(std::move(sensor)), suspended_(false) {
13 : sensor_(std::move(sensor)),
14 binding_(this, std::move(request)),
15 suspended_(false) {
16 sensor_->AddClient(this); 15 sensor_->AddClient(this);
17 } 16 }
18 17
19 SensorImpl::~SensorImpl() { 18 SensorImpl::~SensorImpl() {
20 sensor_->RemoveClient(this); 19 sensor_->RemoveClient(this);
21 } 20 }
22 21
23 mojom::SensorClientRequest SensorImpl::GetClient() { 22 mojom::SensorClientRequest SensorImpl::GetClient() {
24 return mojo::GetProxy(&client_); 23 return mojo::GetProxy(&client_);
25 } 24 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DCHECK(!suspended_); 62 DCHECK(!suspended_);
64 if (client_) 63 if (client_)
65 client_->RaiseError(); 64 client_->RaiseError();
66 } 65 }
67 66
68 bool SensorImpl::IsNotificationSuspended() { 67 bool SensorImpl::IsNotificationSuspended() {
69 return suspended_; 68 return suspended_;
70 } 69 }
71 70
72 } // namespace device 71 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/sensor_impl.h ('k') | device/generic_sensor/sensor_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698