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

Side by Side Diff: webkit/fileapi/media/media_device_map_service.cc

Issue 10781014: Isolated FS for media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/fileapi/media/media_device_map_service.h"
6
7 #include <utility>
8
9 #include "webkit/fileapi/isolated_context.h"
10
11 namespace fileapi {
12
13 using base::SequencedTaskRunner;
14
15 // static
16 MediaDeviceMapService* MediaDeviceMapService::GetInstance() {
17 return Singleton<MediaDeviceMapService>::get();
18 }
19
20 MediaDeviceInterfaceImpl* MediaDeviceMapService::CreateOrGetMediaDevice(
21 const std::string& filesystem_id,
22 SequencedTaskRunner* media_task_runner) {
23 DCHECK(media_task_runner);
24
25 base::AutoLock lock(media_device_map_lock_);
26
27 FilePath device_path;
28 if (!IsolatedContext::GetInstance()->GetRegisteredPath(filesystem_id,
29 &device_path)) {
30 return NULL;
31 }
32
33 FilePath::StringType device_location = device_path.value();
34 DCHECK(!device_location.empty());
35
36 MediaDeviceMap::const_iterator it = media_device_map_.find(device_location);
37 if (it == media_device_map_.end()) {
38 media_device_map_.insert(std::make_pair(
39 device_location, new MediaDeviceInterfaceImpl(device_location,
40 media_task_runner)));
41 }
42 return media_device_map_[device_location].get();
43 }
44
45 void MediaDeviceMapService::RemoveMediaDevice(
46 const std::string& device_location) {
47 base::AutoLock lock(media_device_map_lock_);
48 MediaDeviceMap::iterator it = media_device_map_.find(device_location);
49 if (it != media_device_map_.end())
50 media_device_map_.erase(it);
51 }
52
53 MediaDeviceMapService::MediaDeviceMapService() {
54 }
55
56 MediaDeviceMapService::~MediaDeviceMapService() {
57 }
58
59 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/media/media_device_map_service.h ('k') | webkit/fileapi/media/media_file_system_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698