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

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

Issue 14352004: Split Media-related code from IsolatedMountPointProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "webkit/fileapi/media/device_media_async_file_util.h" 5 #include "webkit/fileapi/media/device_media_async_file_util.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
11 #include "webkit/fileapi/file_system_operation_context.h" 11 #include "webkit/fileapi/file_system_operation_context.h"
12 #include "webkit/fileapi/file_system_task_runners.h" 12 #include "webkit/fileapi/file_system_task_runners.h"
13 #include "webkit/fileapi/file_system_url.h" 13 #include "webkit/fileapi/file_system_url.h"
14 #include "webkit/fileapi/isolated_context.h" 14 #include "webkit/fileapi/isolated_context.h"
15 #include "webkit/fileapi/isolated_mount_point_provider.h"
16 #include "webkit/fileapi/media/filtering_file_enumerator.h" 15 #include "webkit/fileapi/media/filtering_file_enumerator.h"
16 #include "webkit/fileapi/media/media_file_system_mount_point_provider.h"
17 #include "webkit/fileapi/media/media_path_filter.h" 17 #include "webkit/fileapi/media/media_path_filter.h"
18 #include "webkit/fileapi/media/mtp_device_async_delegate.h" 18 #include "webkit/fileapi/media/mtp_device_async_delegate.h"
19 #include "webkit/fileapi/media/mtp_device_map_service.h" 19 #include "webkit/fileapi/media/mtp_device_map_service.h"
20 20
21 namespace fileapi { 21 namespace fileapi {
22 22
23 namespace { 23 namespace {
24 24
25 const base::FilePath::CharType kDeviceMediaAsyncFileUtilTempDir[] = 25 const base::FilePath::CharType kDeviceMediaAsyncFileUtilTempDir[] =
26 FILE_PATH_LITERAL("DeviceMediaFileSystem"); 26 FILE_PATH_LITERAL("DeviceMediaFileSystem");
27 27
28 // Returns true if the current thread is IO thread. 28 // Returns true if the current thread is IO thread.
29 bool IsOnIOThread(FileSystemOperationContext* context) { 29 bool IsOnIOThread(FileSystemOperationContext* context) {
30 return context->file_system_context()->task_runners()-> 30 return context->file_system_context()->task_runners()->
31 io_task_runner()->RunsTasksOnCurrentThread(); 31 io_task_runner()->RunsTasksOnCurrentThread();
32 } 32 }
33 33
34 // Called on the IO thread. 34 // Called on the IO thread.
35 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( 35 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate(
36 FileSystemOperationContext* context) { 36 FileSystemOperationContext* context) {
37 DCHECK(IsOnIOThread(context)); 37 DCHECK(IsOnIOThread(context));
38 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( 38 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate(
39 context->GetUserValue<std::string>( 39 context->GetUserValue<std::string>(
40 IsolatedMountPointProvider::kMTPDeviceDelegateURLKey)); 40 MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey));
41 } 41 }
42 42
43 // Called on a blocking pool thread to create a snapshot file to hold the 43 // Called on a blocking pool thread to create a snapshot file to hold the
44 // contents of |device_file_path|. The snapshot file is created in 44 // contents of |device_file_path|. The snapshot file is created in
45 // "profile_path/kDeviceMediaAsyncFileUtilTempDir" directory. If the snapshot 45 // "profile_path/kDeviceMediaAsyncFileUtilTempDir" directory. If the snapshot
46 // file is created successfully, |snapshot_file_path| will be a non-empty file 46 // file is created successfully, |snapshot_file_path| will be a non-empty file
47 // path. In case of failure, the |snapshot_file_path| will be an empty file 47 // path. In case of failure, the |snapshot_file_path| will be an empty file
48 // path. 48 // path.
49 void CreateSnapshotFileOnBlockingPool( 49 void CreateSnapshotFileOnBlockingPool(
50 const base::FilePath& device_file_path, 50 const base::FilePath& device_file_path,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 *snapshot_file_path, 341 *snapshot_file_path,
342 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, 342 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile,
343 weak_ptr_factory_.GetWeakPtr(), 343 weak_ptr_factory_.GetWeakPtr(),
344 callback), 344 callback),
345 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, 345 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError,
346 weak_ptr_factory_.GetWeakPtr(), 346 weak_ptr_factory_.GetWeakPtr(),
347 callback)); 347 callback));
348 } 348 }
349 349
350 } // namespace fileapi 350 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_mount_point_provider.cc ('k') | webkit/fileapi/media/media_file_system_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698