OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/drive/debug_info_collector.h" | 5 #include "chrome/browser/chromeos/drive/debug_info_collector.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "google_apis/drive/task_util.h" | 10 #include "google_apis/drive/task_util.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK(metadata_); | 61 DCHECK(metadata_); |
62 DCHECK(file_system_); | 62 DCHECK(file_system_); |
63 } | 63 } |
64 | 64 |
65 DebugInfoCollector::~DebugInfoCollector() { | 65 DebugInfoCollector::~DebugInfoCollector() { |
66 } | 66 } |
67 | 67 |
68 void DebugInfoCollector::GetResourceEntry( | 68 void DebugInfoCollector::GetResourceEntry( |
69 const base::FilePath& file_path, | 69 const base::FilePath& file_path, |
70 const GetResourceEntryCallback& callback) { | 70 const GetResourceEntryCallback& callback) { |
71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 71 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
72 DCHECK(!callback.is_null()); | 72 DCHECK(!callback.is_null()); |
73 | 73 |
74 scoped_ptr<ResourceEntry> entry(new ResourceEntry); | 74 scoped_ptr<ResourceEntry> entry(new ResourceEntry); |
75 ResourceEntry* entry_ptr = entry.get(); | 75 ResourceEntry* entry_ptr = entry.get(); |
76 base::PostTaskAndReplyWithResult( | 76 base::PostTaskAndReplyWithResult( |
77 blocking_task_runner_.get(), | 77 blocking_task_runner_.get(), |
78 FROM_HERE, | 78 FROM_HERE, |
79 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, | 79 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, |
80 base::Unretained(metadata_), | 80 base::Unretained(metadata_), |
81 file_path, | 81 file_path, |
82 entry_ptr), | 82 entry_ptr), |
83 base::Bind(&RunGetResourceEntryCallback, callback, base::Passed(&entry))); | 83 base::Bind(&RunGetResourceEntryCallback, callback, base::Passed(&entry))); |
84 } | 84 } |
85 | 85 |
86 void DebugInfoCollector::ReadDirectory( | 86 void DebugInfoCollector::ReadDirectory( |
87 const base::FilePath& file_path, | 87 const base::FilePath& file_path, |
88 const ReadDirectoryCallback& callback) { | 88 const ReadDirectoryCallback& callback) { |
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 89 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
90 DCHECK(!callback.is_null()); | 90 DCHECK(!callback.is_null()); |
91 | 91 |
92 scoped_ptr<ResourceEntryVector> entries(new ResourceEntryVector); | 92 scoped_ptr<ResourceEntryVector> entries(new ResourceEntryVector); |
93 ResourceEntryVector* entries_ptr = entries.get(); | 93 ResourceEntryVector* entries_ptr = entries.get(); |
94 base::PostTaskAndReplyWithResult( | 94 base::PostTaskAndReplyWithResult( |
95 blocking_task_runner_.get(), | 95 blocking_task_runner_.get(), |
96 FROM_HERE, | 96 FROM_HERE, |
97 base::Bind(&internal::ResourceMetadata::ReadDirectoryByPath, | 97 base::Bind(&internal::ResourceMetadata::ReadDirectoryByPath, |
98 base::Unretained(metadata_), | 98 base::Unretained(metadata_), |
99 file_path, | 99 file_path, |
100 entries_ptr), | 100 entries_ptr), |
101 base::Bind(&RunReadDirectoryCallback, callback, base::Passed(&entries))); | 101 base::Bind(&RunReadDirectoryCallback, callback, base::Passed(&entries))); |
102 } | 102 } |
103 | 103 |
104 void DebugInfoCollector::IterateFileCache( | 104 void DebugInfoCollector::IterateFileCache( |
105 const IterateFileCacheCallback& iteration_callback, | 105 const IterateFileCacheCallback& iteration_callback, |
106 const base::Closure& completion_callback) { | 106 const base::Closure& completion_callback) { |
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 107 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
108 DCHECK(!iteration_callback.is_null()); | 108 DCHECK(!iteration_callback.is_null()); |
109 DCHECK(!completion_callback.is_null()); | 109 DCHECK(!completion_callback.is_null()); |
110 | 110 |
111 blocking_task_runner_->PostTaskAndReply( | 111 blocking_task_runner_->PostTaskAndReply( |
112 FROM_HERE, | 112 FROM_HERE, |
113 base::Bind(&IterateFileCacheInternal, | 113 base::Bind(&IterateFileCacheInternal, |
114 metadata_, | 114 metadata_, |
115 google_apis::CreateRelayCallback(iteration_callback)), | 115 google_apis::CreateRelayCallback(iteration_callback)), |
116 completion_callback); | 116 completion_callback); |
117 } | 117 } |
118 | 118 |
119 void DebugInfoCollector::GetMetadata( | 119 void DebugInfoCollector::GetMetadata( |
120 const GetFilesystemMetadataCallback& callback) { | 120 const GetFilesystemMetadataCallback& callback) { |
121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 121 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
122 DCHECK(!callback.is_null()); | 122 DCHECK(!callback.is_null()); |
123 | 123 |
124 // Currently, this is just a proxy to the FileSystem. | 124 // Currently, this is just a proxy to the FileSystem. |
125 // TODO(hidehiko): Move the implementation to here to simplify the | 125 // TODO(hidehiko): Move the implementation to here to simplify the |
126 // FileSystem's implementation. crbug.com/237088 | 126 // FileSystem's implementation. crbug.com/237088 |
127 file_system_->GetMetadata(callback); | 127 file_system_->GetMetadata(callback); |
128 } | 128 } |
129 | 129 |
130 } // namespace drive | 130 } // namespace drive |
OLD | NEW |