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

Side by Side Diff: chrome/browser/media_galleries/fileapi/native_media_file_util.cc

Issue 1102233002: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/media_galleries , metrics and nacl_host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/browser/metrics/chromeos_metrics_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/media_galleries/fileapi/native_media_file_util.h" 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 void HoldFileRef( 49 void HoldFileRef(
50 const scoped_refptr<storage::ShareableFileReference>& file_ref) { 50 const scoped_refptr<storage::ShareableFileReference>& file_ref) {
51 } 51 }
52 52
53 void DidOpenSnapshot( 53 void DidOpenSnapshot(
54 const storage::AsyncFileUtil::CreateOrOpenCallback& callback, 54 const storage::AsyncFileUtil::CreateOrOpenCallback& callback,
55 const scoped_refptr<storage::ShareableFileReference>& file_ref, 55 const scoped_refptr<storage::ShareableFileReference>& file_ref,
56 base::File file) { 56 base::File file) {
57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 57 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
58 if (!file.IsValid()) { 58 if (!file.IsValid()) {
59 callback.Run(file.Pass(), base::Closure()); 59 callback.Run(file.Pass(), base::Closure());
60 return; 60 return;
61 } 61 }
62 callback.Run(file.Pass(), base::Bind(&HoldFileRef, file_ref)); 62 callback.Run(file.Pass(), base::Bind(&HoldFileRef, file_ref));
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 NativeMediaFileUtil::NativeMediaFileUtil(MediaPathFilter* media_path_filter) 67 NativeMediaFileUtil::NativeMediaFileUtil(MediaPathFilter* media_path_filter)
(...skipping 29 matching lines...) Expand all
97 97
98 // static 98 // static
99 void NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen( 99 void NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen(
100 base::SequencedTaskRunner* media_task_runner, 100 base::SequencedTaskRunner* media_task_runner,
101 int file_flags, 101 int file_flags,
102 const storage::AsyncFileUtil::CreateOrOpenCallback& callback, 102 const storage::AsyncFileUtil::CreateOrOpenCallback& callback,
103 base::File::Error result, 103 base::File::Error result,
104 const base::File::Info& file_info, 104 const base::File::Info& file_info,
105 const base::FilePath& platform_path, 105 const base::FilePath& platform_path,
106 const scoped_refptr<storage::ShareableFileReference>& file_ref) { 106 const scoped_refptr<storage::ShareableFileReference>& file_ref) {
107 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 107 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
108 if (result != base::File::FILE_OK) { 108 if (result != base::File::FILE_OK) {
109 callback.Run(base::File(), base::Closure()); 109 callback.Run(base::File(), base::Closure());
110 return; 110 return;
111 } 111 }
112 base::PostTaskAndReplyWithResult( 112 base::PostTaskAndReplyWithResult(
113 media_task_runner, 113 media_task_runner,
114 FROM_HERE, 114 FROM_HERE,
115 base::Bind( 115 base::Bind(
116 &storage::NativeFileUtil::CreateOrOpen, platform_path, file_flags), 116 &storage::NativeFileUtil::CreateOrOpen, platform_path, file_flags),
117 base::Bind(&DidOpenSnapshot, callback, file_ref)); 117 base::Bind(&DidOpenSnapshot, callback, file_ref));
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 return base::File::FILE_ERROR_FAILED; 671 return base::File::FILE_ERROR_FAILED;
672 672
673 if (!file_info.is_directory && 673 if (!file_info.is_directory &&
674 !media_path_filter_->Match(file_path)) { 674 !media_path_filter_->Match(file_path)) {
675 return failure_error; 675 return failure_error;
676 } 676 }
677 677
678 *local_file_path = file_path; 678 *local_file_path = file_path;
679 return base::File::FILE_OK; 679 return base::File::FILE_OK;
680 } 680 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/metrics/chromeos_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698