| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/device_sensors/data_fetcher_shared_memory.h" | 5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" |
| 6 | 6 |
| 7 #include <GuidDef.h> | 7 #include <GuidDef.h> |
| 8 #include <InitGuid.h> | 8 #include <InitGuid.h> |
| 9 #include <PortableDeviceTypes.h> | 9 #include <PortableDeviceTypes.h> |
| 10 #include <Sensors.h> | 10 #include <Sensors.h> |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 break; | 335 break; |
| 336 default: | 336 default: |
| 337 NOTREACHED(); | 337 NOTREACHED(); |
| 338 } | 338 } |
| 339 return false; | 339 return false; |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { | 342 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
| 343 DisableSensors(consumer_type); | 343 DisableSensors(consumer_type); |
| 344 SetBufferAvailableState(consumer_type, false); | |
| 345 switch (consumer_type) { | 344 switch (consumer_type) { |
| 346 case CONSUMER_TYPE_ORIENTATION: | 345 case CONSUMER_TYPE_ORIENTATION: |
| 346 SetBufferAvailableState(consumer_type, false); |
| 347 orientation_buffer_ = nullptr; | 347 orientation_buffer_ = nullptr; |
| 348 return true; | 348 return true; |
| 349 case CONSUMER_TYPE_MOTION: | 349 case CONSUMER_TYPE_MOTION: |
| 350 SetBufferAvailableState(consumer_type, false); |
| 350 motion_buffer_ = nullptr; | 351 motion_buffer_ = nullptr; |
| 351 return true; | 352 return true; |
| 352 case CONSUMER_TYPE_LIGHT: | 353 case CONSUMER_TYPE_LIGHT: |
| 353 SetLightBuffer(light_buffer_, -1); | 354 SetLightBuffer(light_buffer_, -1); |
| 354 light_buffer_ = nullptr; | 355 light_buffer_ = nullptr; |
| 355 return true; | 356 return true; |
| 356 default: | 357 default: |
| 357 NOTREACHED(); | 358 NOTREACHED(); |
| 358 } | 359 } |
| 359 return false; | 360 return false; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 motion_buffer_->data.allAvailableSensorsAreActive = enabled; | 456 motion_buffer_->data.allAvailableSensorsAreActive = enabled; |
| 456 motion_buffer_->seqlock.WriteEnd(); | 457 motion_buffer_->seqlock.WriteEnd(); |
| 457 } | 458 } |
| 458 break; | 459 break; |
| 459 default: | 460 default: |
| 460 NOTREACHED(); | 461 NOTREACHED(); |
| 461 } | 462 } |
| 462 } | 463 } |
| 463 | 464 |
| 464 } // namespace content | 465 } // namespace content |
| OLD | NEW |