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

Unified Diff: webkit/fileapi/media/media_device_map_service.h

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 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: webkit/fileapi/media/media_device_map_service.h
diff --git a/webkit/fileapi/media/media_device_map_service.h b/webkit/fileapi/media/media_device_map_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8f2aea6e9c891cc9bd0ff1f6d044637b331b6c5
--- /dev/null
+++ b/webkit/fileapi/media/media_device_map_service.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_FILEAPI_MEDIA_MEDIA_DEVICE_MAP_SERVICE_H_
+#define WEBKIT_FILEAPI_MEDIA_MEDIA_DEVICE_MAP_SERVICE_H_
+
+#include <map>
+
+#include "base/file_path.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/singleton.h"
+#include "base/synchronization/lock.h"
+#include "webkit/fileapi/media/media_device_interface_impl.h"
+
+namespace base {
+class SequencedTaskRunner;
+}
+
+namespace fileapi {
+
+// Helper class to manage media device interfaces.
+class FILEAPI_EXPORT MediaDeviceMapService {
+ public:
+ static MediaDeviceMapService* GetInstance();
+
+ // This function is called on IO thread.
+ void MaybeAddMediaDevice(const FilePath::StringType& device_id,
+ base::SequencedTaskRunner* media_task_runner);
+
+ // This function is called on UI thread.
+ void RemoveMediaDevice(const FilePath::StringType& device_id);
+
+ // This function is called on IO thread. Returns NULL on failure.
+ MediaDeviceInterfaceImpl* GetMediaDevice(
+ const FilePath::StringType& device_id);
+
+ private:
+ MediaDeviceMapService();
Lei Zhang 2012/07/31 20:48:18 Add a note to say "access through GetInstance()"
kmadhusu 2012/08/01 01:43:59 Done.
+ ~MediaDeviceMapService();
+
+ friend struct DefaultSingletonTraits<MediaDeviceMapService>;
Lei Zhang 2012/07/31 20:48:18 nit: friends and typedefs go above the ctor/dtor
kmadhusu 2012/08/01 01:43:59 Done.
+
+ typedef scoped_refptr<MediaDeviceInterfaceImpl> MediaDeviceRefPtr;
+ typedef std::map<FilePath::StringType, MediaDeviceRefPtr> MediaDeviceMap;
+
+ base::Lock media_device_map_lock_;
+
+ // Store a map of attached mtp devices.
+ // Key: Device id.
+ // Value: MtpDeviceInterface.
+ MediaDeviceMap media_device_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaDeviceMapService);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_MEDIA_MEDIA_DEVICE_MAP_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698