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

Unified Diff: content/browser/device_sensors/data_fetcher_shared_memory_base.h

Issue 2037513002: Convert device_sensors to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@conversion--mime-registry
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/device_sensors/data_fetcher_shared_memory_base.h
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_base.h b/content/browser/device_sensors/data_fetcher_shared_memory_base.h
index f6431f82ffeb4691c1d050ec963e2c0bc1e9ca88..f8326aac03791e2272280f3d97db6e450aa4539f 100644
--- a/content/browser/device_sensors/data_fetcher_shared_memory_base.h
+++ b/content/browser/device_sensors/data_fetcher_shared_memory_base.h
@@ -13,6 +13,7 @@
#include "base/message_loop/message_loop.h"
#include "content/browser/device_sensors/device_sensors_consts.h"
#include "content/common/content_export.h"
+#include "mojo/public/cpp/system/buffer.h"
namespace content {
@@ -36,12 +37,11 @@ class CONTENT_EXPORT DataFetcherSharedMemoryBase {
// sensors are unregistered.
virtual void Shutdown();
- // Returns the shared memory handle of the device sensor data
- // duplicated into the given process. This method should only be
- // called after a call to StartFetchingDeviceData method with
+ // Returns the shared memory handle of the device sensor data. This method
+ // should only be called after a call to StartFetchingDeviceData method with
// corresponding |consumer_type| parameter.
- base::SharedMemoryHandle GetSharedMemoryHandleForProcess(
- ConsumerType consumer_type, base::ProcessHandle process);
+ mojo::ScopedSharedBufferHandle GetSharedMemoryHandle(
+ ConsumerType consumer_type);
enum FetcherType {
// Fetcher runs on the same thread as its creator.
@@ -84,15 +84,15 @@ class CONTENT_EXPORT DataFetcherSharedMemoryBase {
private:
bool InitAndStartPollingThreadIfNecessary();
- base::SharedMemory* GetSharedMemory(ConsumerType consumer_type);
void* GetSharedMemoryBuffer(ConsumerType consumer_type);
unsigned started_consumers_;
std::unique_ptr<PollingThread> polling_thread_;
- // Owning pointers. Objects in the map are deleted in dtor.
- typedef std::map<ConsumerType, base::SharedMemory*> SharedMemoryMap;
+ using SharedMemoryMap = std::map<ConsumerType,
+ std::pair<mojo::ScopedSharedBufferHandle,
+ mojo::ScopedSharedBufferMapping>>;
SharedMemoryMap shared_memory_map_;
DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemoryBase);

Powered by Google App Engine
This is Rietveld 408576698