diff options
author | rijubrata.bhaumik <rijubrata.bhaumik@intel.com> | 2015-01-21 06:40:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-21 14:41:45 +0000 |
commit | 24a0f3a78b2bc83f4b7f54748f4907f7053893ec (patch) | |
tree | 0b38cb47766d94f5fc01cb3a323c118f18d3e929 | |
parent | ef0ffb7c3d8532fa50a50ac8d3a4de9e8ef6492f (diff) | |
download | chromium_src-24a0f3a78b2bc83f4b7f54748f4907f7053893ec.zip chromium_src-24a0f3a78b2bc83f4b7f54748f4907f7053893ec.tar.gz chromium_src-24a0f3a78b2bc83f4b7f54748f4907f7053893ec.tar.bz2 |
Use nullptr instead of NULL in device_sensors
BUG=none
Review URL: https://codereview.chromium.org/860073003
Cr-Commit-Position: refs/heads/master@{#312378}
10 files changed, 39 insertions, 39 deletions
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc b/content/browser/device_sensors/data_fetcher_shared_memory_base.cc index d997537..6045009 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_base.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_base.cc @@ -218,7 +218,7 @@ base::SharedMemory* DataFetcherSharedMemoryBase::GetSharedMemory( size_t buffer_size = GetConsumerSharedMemoryBufferSize(consumer_type); if (buffer_size == 0) - return NULL; + return nullptr; scoped_ptr<base::SharedMemory> new_shared_mem(new base::SharedMemory); if (new_shared_mem->CreateAndMapAnonymous(buffer_size)) { @@ -230,18 +230,18 @@ base::SharedMemory* DataFetcherSharedMemoryBase::GetSharedMemory( } } LOG(ERROR) << "Failed to initialize shared memory"; - return NULL; + return nullptr; } void* DataFetcherSharedMemoryBase::GetSharedMemoryBuffer( ConsumerType consumer_type) { if (base::SharedMemory* shared_memory = GetSharedMemory(consumer_type)) return shared_memory->memory(); - return NULL; + return nullptr; } base::MessageLoop* DataFetcherSharedMemoryBase::GetPollingMessageLoop() const { - return polling_thread_ ? polling_thread_->message_loop() : NULL; + return polling_thread_ ? polling_thread_->message_loop() : nullptr; } bool DataFetcherSharedMemoryBase::IsPollingTimerRunningForTesting() const { diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc b/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc index aa1a9a9..e13cd89 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_base_unittest.cc @@ -29,9 +29,9 @@ class FakeDataFetcher : public DataFetcherSharedMemoryBase { updated_light_(false, false), updated_motion_(false, false), updated_orientation_(false, false), - light_buffer_(NULL), - motion_buffer_(NULL), - orientation_buffer_(NULL) {} + light_buffer_(nullptr), + motion_buffer_(nullptr), + orientation_buffer_(nullptr) {} ~FakeDataFetcher() override {} bool Init(ConsumerType consumer_type, void* buffer) { diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_default.cc b/content/browser/device_sensors/data_fetcher_shared_memory_default.cc index 5294e8e..e1100b4e 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_default.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_default.cc @@ -44,7 +44,9 @@ static bool SetLightBuffer(content::DeviceLightHardwareBuffer* buffer, namespace content { DataFetcherSharedMemory::DataFetcherSharedMemory() - : motion_buffer_(NULL), orientation_buffer_(NULL), light_buffer_(NULL) { + : motion_buffer_(nullptr), + orientation_buffer_(nullptr), + light_buffer_(nullptr) { } DataFetcherSharedMemory::~DataFetcherSharedMemory() { diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc b/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc index 34e23a8..b9538f2 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_mac.cc @@ -164,7 +164,8 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { case CONSUMER_TYPE_MOTION: { if (!sudden_motion_sensor_) sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); - bool sudden_motion_sensor_available = sudden_motion_sensor_.get() != NULL; + bool sudden_motion_sensor_available = + sudden_motion_sensor_.get() != nullptr; motion_buffer_ = static_cast<DeviceMotionHardwareBuffer*>(buffer); UMA_HISTOGRAM_BOOLEAN("InertialSensor.MotionMacAvailable", @@ -180,7 +181,8 @@ bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { case CONSUMER_TYPE_ORIENTATION: { if (!sudden_motion_sensor_) sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); - bool sudden_motion_sensor_available = sudden_motion_sensor_.get() != NULL; + bool sudden_motion_sensor_available = + sudden_motion_sensor_.get() != nullptr; orientation_buffer_ = static_cast<DeviceOrientationHardwareBuffer*>(buffer); @@ -229,7 +231,7 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { motion_buffer_->seqlock.WriteBegin(); motion_buffer_->data.allAvailableSensorsAreActive = false; motion_buffer_->seqlock.WriteEnd(); - motion_buffer_ = NULL; + motion_buffer_ = nullptr; } return true; case CONSUMER_TYPE_ORIENTATION: @@ -237,7 +239,7 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { orientation_buffer_->seqlock.WriteBegin(); orientation_buffer_->data.allAvailableSensorsAreActive = false; orientation_buffer_->seqlock.WriteEnd(); - orientation_buffer_ = NULL; + orientation_buffer_ = nullptr; } return true; case CONSUMER_TYPE_LIGHT: diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_win.cc b/content/browser/device_sensors/data_fetcher_shared_memory_win.cc index 01d1954..c5d24fc 100644 --- a/content/browser/device_sensors/data_fetcher_shared_memory_win.cc +++ b/content/browser/device_sensors/data_fetcher_shared_memory_win.cc @@ -64,12 +64,12 @@ class DataFetcherSharedMemory::SensorEventSink STDMETHODIMP OnDataUpdated(ISensor* sensor, ISensorDataReport* new_data) override { - if (NULL == new_data || NULL == sensor) + if (nullptr == new_data || nullptr == sensor) return E_INVALIDARG; return UpdateSharedMemoryBuffer(sensor, new_data) ? S_OK : E_FAIL; } -protected: + protected: virtual bool UpdateSharedMemoryBuffer( ISensor* sensor, ISensorDataReport* new_data) = 0; @@ -100,7 +100,7 @@ class DataFetcherSharedMemory::SensorEventSinkOrientation DeviceOrientationHardwareBuffer* const buffer) : buffer_(buffer) {} virtual ~SensorEventSinkOrientation() {} -protected: + protected: virtual bool UpdateSharedMemoryBuffer( ISensor* sensor, ISensorDataReport* new_data) override { double alpha, beta, gamma; @@ -216,16 +216,14 @@ class DataFetcherSharedMemory::SensorEventSinkMotion return true; } - private: - DeviceMotionHardwareBuffer* const buffer_; - - DISALLOW_COPY_AND_ASSIGN(SensorEventSinkMotion); - }; + private: + DeviceMotionHardwareBuffer* const buffer_; + DISALLOW_COPY_AND_ASSIGN(SensorEventSinkMotion); +}; DataFetcherSharedMemory::DataFetcherSharedMemory() - : motion_buffer_(NULL), - orientation_buffer_(NULL) { + : motion_buffer_(nullptr), orientation_buffer_(nullptr) { } DataFetcherSharedMemory::~DataFetcherSharedMemory() { @@ -290,10 +288,10 @@ bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { SetBufferAvailableState(consumer_type, false); switch (consumer_type) { case CONSUMER_TYPE_ORIENTATION: - orientation_buffer_ = NULL; + orientation_buffer_ = nullptr; return true; case CONSUMER_TYPE_MOTION: - motion_buffer_ = NULL; + motion_buffer_ = nullptr; return true; default: NOTREACHED(); @@ -356,17 +354,17 @@ void DataFetcherSharedMemory::DisableSensors(ConsumerType consumer_type) { switch(consumer_type) { case CONSUMER_TYPE_ORIENTATION: if (sensor_inclinometer_.get()) { - sensor_inclinometer_->SetEventSink(NULL); + sensor_inclinometer_->SetEventSink(nullptr); sensor_inclinometer_.Release(); } break; case CONSUMER_TYPE_MOTION: if (sensor_accelerometer_.get()) { - sensor_accelerometer_->SetEventSink(NULL); + sensor_accelerometer_->SetEventSink(nullptr); sensor_accelerometer_.Release(); } if (sensor_gyrometer_.get()) { - sensor_gyrometer_->SetEventSink(NULL); + sensor_gyrometer_->SetEventSink(nullptr); sensor_gyrometer_.Release(); } break; diff --git a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc index 14358aa..36210cf 100644 --- a/content/browser/device_sensors/device_inertial_sensor_browsertest.cc +++ b/content/browser/device_sensors/device_inertial_sensor_browsertest.cc @@ -178,9 +178,7 @@ class FakeDataFetcher : public DataFetcherSharedMemory { class DeviceInertialSensorBrowserTest : public ContentBrowserTest { public: DeviceInertialSensorBrowserTest() - : fetcher_(NULL), - io_loop_finished_event_(false, false) { - } + : fetcher_(nullptr), io_loop_finished_event_(false, false) {} void SetUpOnMainThread() override { BrowserThread::PostTask( diff --git a/content/browser/device_sensors/sensor_manager_android.cc b/content/browser/device_sensors/sensor_manager_android.cc index 49750b0..715a7c7 100644 --- a/content/browser/device_sensors/sensor_manager_android.cc +++ b/content/browser/device_sensors/sensor_manager_android.cc @@ -35,9 +35,9 @@ namespace content { SensorManagerAndroid::SensorManagerAndroid() : number_active_device_motion_sensors_(0), - device_light_buffer_(NULL), - device_motion_buffer_(NULL), - device_orientation_buffer_(NULL), + device_light_buffer_(nullptr), + device_motion_buffer_(nullptr), + device_orientation_buffer_(nullptr), is_light_buffer_ready_(false), is_motion_buffer_ready_(false), is_orientation_buffer_ready_(false), @@ -216,7 +216,7 @@ void SensorManagerAndroid::StopFetchingDeviceLightData() { base::AutoLock autolock(light_buffer_lock_); if (device_light_buffer_) { SetLightBufferValue(-1); - device_light_buffer_ = NULL; + device_light_buffer_ = nullptr; } } } @@ -255,7 +255,7 @@ void SensorManagerAndroid::StopFetchingDeviceMotionData() { base::AutoLock autolock(motion_buffer_lock_); if (device_motion_buffer_) { ClearInternalMotionBuffers(); - device_motion_buffer_ = NULL; + device_motion_buffer_ = nullptr; } } } @@ -338,7 +338,7 @@ void SensorManagerAndroid::StopFetchingDeviceOrientationData() { base::AutoLock autolock(orientation_buffer_lock_); if (device_orientation_buffer_) { SetOrientationBufferReadyStatus(false); - device_orientation_buffer_ = NULL; + device_orientation_buffer_ = nullptr; } } } diff --git a/content/renderer/device_sensors/device_light_event_pump_unittest.cc b/content/renderer/device_sensors/device_light_event_pump_unittest.cc index dadc4e3..4f19f0d 100644 --- a/content/renderer/device_sensors/device_light_event_pump_unittest.cc +++ b/content/renderer/device_sensors/device_light_event_pump_unittest.cc @@ -67,7 +67,7 @@ class DeviceLightEventPumpTest : public testing::Test { protected: void SetUp() override { - const DeviceLightHardwareBuffer* null_buffer = NULL; + const DeviceLightHardwareBuffer* null_buffer = nullptr; listener_.reset(new MockDeviceLightListener); light_pump_.reset(new DeviceLightEventPumpForTesting); buffer_ = static_cast<DeviceLightHardwareBuffer*>(shared_memory_.memory()); diff --git a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc index 13b204f..5b88d66 100644 --- a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc +++ b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc @@ -71,7 +71,7 @@ class DeviceMotionEventPumpTest : public testing::Test { protected: void SetUp() override { - const DeviceMotionHardwareBuffer* null_buffer = NULL; + const DeviceMotionHardwareBuffer* null_buffer = nullptr; listener_.reset(new MockDeviceMotionListener); motion_pump_.reset(new DeviceMotionEventPumpForTesting); buffer_ = static_cast<DeviceMotionHardwareBuffer*>(shared_memory_.memory()); diff --git a/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc b/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc index 35792f9..8dd10cb 100644 --- a/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc +++ b/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc @@ -74,7 +74,7 @@ class DeviceOrientationEventPumpTest : public testing::Test { protected: void SetUp() override { - const DeviceOrientationHardwareBuffer* null_buffer = NULL; + const DeviceOrientationHardwareBuffer* null_buffer = nullptr; listener_.reset(new MockDeviceOrientationListener); orientation_pump_.reset(new DeviceOrientationEventPumpForTesting); buffer_ = static_cast<DeviceOrientationHardwareBuffer*>( |