Commit 1f85ea74 authored by Austin Tankiang's avatar Austin Tankiang Committed by Commit Bot

Remove unused DebugInfoCollector

Bug: 1003238
Change-Id: I39923254ddffe7d29bef0debc4f8f083547d7f3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886134
Commit-Queue: Austin Tankiang <austinct@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710540}
parent 31fcb756
...@@ -881,8 +881,6 @@ source_set("chromeos") { ...@@ -881,8 +881,6 @@ source_set("chromeos") {
"device_sync/device_sync_client_factory.h", "device_sync/device_sync_client_factory.h",
"display/quirks_manager_delegate_impl.cc", "display/quirks_manager_delegate_impl.cc",
"display/quirks_manager_delegate_impl.h", "display/quirks_manager_delegate_impl.h",
"drive/debug_info_collector.cc",
"drive/debug_info_collector.h",
"drive/drive_integration_service.cc", "drive/drive_integration_service.cc",
"drive/drive_integration_service.h", "drive/drive_integration_service.h",
"drive/file_system_util.cc", "drive/file_system_util.cc",
......
// Copyright 2013 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.
#include "chrome/browser/chromeos/drive/debug_info_collector.h"
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
#include "google_apis/drive/task_util.h"
namespace drive {
namespace {
void IterateFileCacheInternal(
internal::ResourceMetadata* metadata,
const DebugInfoCollector::IterateFileCacheCallback& iteration_callback) {
std::unique_ptr<internal::ResourceMetadata::Iterator> it =
metadata->GetIterator();
for (; !it->IsAtEnd(); it->Advance()) {
if (it->GetValue().file_specific_info().has_cache_state()) {
iteration_callback.Run(it->GetID(),
it->GetValue().file_specific_info().cache_state());
}
}
DCHECK(!it->HasError());
}
// Runs the callback with arguments.
void RunGetResourceEntryCallback(GetResourceEntryCallback callback,
std::unique_ptr<ResourceEntry> entry,
FileError error) {
DCHECK(callback);
if (error != FILE_ERROR_OK)
entry.reset();
std::move(callback).Run(error, std::move(entry));
}
// Runs the callback with arguments.
void RunReadDirectoryCallback(
const DebugInfoCollector::ReadDirectoryCallback& callback,
std::unique_ptr<ResourceEntryVector> entries,
FileError error) {
DCHECK(callback);
if (error != FILE_ERROR_OK)
entries.reset();
callback.Run(error, std::move(entries));
}
} // namespace
DebugInfoCollector::DebugInfoCollector(
internal::ResourceMetadata* metadata,
FileSystemInterface* file_system,
base::SequencedTaskRunner* blocking_task_runner)
: metadata_(metadata),
file_system_(file_system),
blocking_task_runner_(blocking_task_runner) {
DCHECK(metadata_);
DCHECK(file_system_);
}
DebugInfoCollector::~DebugInfoCollector() = default;
void DebugInfoCollector::GetResourceEntry(const base::FilePath& file_path,
GetResourceEntryCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(callback);
std::unique_ptr<ResourceEntry> entry(new ResourceEntry);
ResourceEntry* entry_ptr = entry.get();
base::PostTaskAndReplyWithResult(
blocking_task_runner_.get(), FROM_HERE,
base::BindOnce(&internal::ResourceMetadata::GetResourceEntryByPath,
base::Unretained(metadata_), file_path, entry_ptr),
base::BindOnce(&RunGetResourceEntryCallback, std::move(callback),
base::Passed(&entry)));
}
void DebugInfoCollector::ReadDirectory(
const base::FilePath& file_path,
const ReadDirectoryCallback& callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(callback);
std::unique_ptr<ResourceEntryVector> entries(new ResourceEntryVector);
ResourceEntryVector* entries_ptr = entries.get();
base::PostTaskAndReplyWithResult(
blocking_task_runner_.get(),
FROM_HERE,
base::Bind(&internal::ResourceMetadata::ReadDirectoryByPath,
base::Unretained(metadata_),
file_path,
entries_ptr),
base::Bind(&RunReadDirectoryCallback, callback, base::Passed(&entries)));
}
void DebugInfoCollector::IterateFileCache(
const IterateFileCacheCallback& iteration_callback,
const base::Closure& completion_callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(iteration_callback);
DCHECK(completion_callback);
blocking_task_runner_->PostTaskAndReply(
FROM_HERE,
base::BindOnce(&IterateFileCacheInternal, metadata_,
google_apis::CreateRelayCallback(iteration_callback)),
completion_callback);
}
void DebugInfoCollector::GetMetadata(GetFilesystemMetadataCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(callback);
// Currently, this is just a proxy to the FileSystem.
// TODO(hidehiko): Move the implementation to here to simplify the
// FileSystem's implementation. crbug.com/237088
file_system_->GetMetadata(std::move(callback));
}
} // namespace drive
// Copyright 2013 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 CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
#define CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "components/drive/chromeos/file_system_interface.h"
namespace drive {
// This class provides some methods which are useful to show the debug
// info on chrome://drive-internals page.
// All the method should be called on UI thread.
class DebugInfoCollector {
public:
// Callback for ReadDirectory().
typedef base::Callback<void(FileError error,
std::unique_ptr<ResourceEntryVector> entries)>
ReadDirectoryCallback;
// Callback for IterateFileCache().
typedef base::Callback<void(const std::string& id,
const FileCacheEntry& cache_entry)>
IterateFileCacheCallback;
DebugInfoCollector(internal::ResourceMetadata* metadata,
FileSystemInterface* file_system,
base::SequencedTaskRunner* blocking_task_runner);
~DebugInfoCollector();
// Finds a locally stored entry (a file or a directory) by |file_path|.
// |callback| must not be null.
void GetResourceEntry(const base::FilePath& file_path,
GetResourceEntryCallback callback);
// Finds and reads a directory by |file_path|.
// |callback| must not be null.
void ReadDirectory(const base::FilePath& file_path,
const ReadDirectoryCallback& callback);
// Iterates all files in the file cache and calls |iteration_callback| for
// each file. |completion_callback| is run upon completion.
// |iteration_callback| and |completion_callback| must not be null.
void IterateFileCache(const IterateFileCacheCallback& iteration_callback,
const base::Closure& completion_callback);
// Returns miscellaneous metadata of the file system like the largest
// timestamp. |callback| must not be null.
void GetMetadata(GetFilesystemMetadataCallback callback);
private:
internal::ResourceMetadata* metadata_; // No owned.
FileSystemInterface* file_system_; // Not owned.
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(DebugInfoCollector);
};
} // namespace drive
#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DEBUG_INFO_COLLECTOR_H_
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/drive/debug_info_collector.h"
#include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
...@@ -732,9 +731,6 @@ DriveIntegrationService::DriveIntegrationService( ...@@ -732,9 +731,6 @@ DriveIntegrationService::DriveIntegrationService(
logger_.get(), cache_.get(), scheduler_.get(), logger_.get(), cache_.get(), scheduler_.get(),
resource_metadata_.get(), blocking_task_runner_.get(), resource_metadata_.get(), blocking_task_runner_.get(),
cache_root_directory_.Append(kTemporaryFileDirectory))); cache_root_directory_.Append(kTemporaryFileDirectory)));
debug_info_collector_ = std::make_unique<DebugInfoCollector>(
resource_metadata_.get(), file_system(), blocking_task_runner_.get());
notification_manager_ = notification_manager_ =
std::make_unique<DriveIntegrationService::NotificationManager>(profile); std::make_unique<DriveIntegrationService::NotificationManager>(profile);
...@@ -759,7 +755,6 @@ void DriveIntegrationService::Shutdown() { ...@@ -759,7 +755,6 @@ void DriveIntegrationService::Shutdown() {
RemoveDriveMountPoint(); RemoveDriveMountPoint();
notification_manager_.reset(); notification_manager_.reset();
debug_info_collector_.reset();
file_system_.reset(); file_system_.reset();
scheduler_.reset(); scheduler_.reset();
drive_service_.reset(); drive_service_.reset();
......
...@@ -42,7 +42,6 @@ class DriveFs; ...@@ -42,7 +42,6 @@ class DriveFs;
namespace drive { namespace drive {
class DebugInfoCollector;
class DriveServiceInterface; class DriveServiceInterface;
class EventLogger; class EventLogger;
class FileSystemInterface; class FileSystemInterface;
...@@ -168,9 +167,6 @@ class DriveIntegrationService : public KeyedService, ...@@ -168,9 +167,6 @@ class DriveIntegrationService : public KeyedService,
EventLogger* event_logger() { return logger_.get(); } EventLogger* event_logger() { return logger_.get(); }
DriveServiceInterface* drive_service() { return drive_service_.get(); } DriveServiceInterface* drive_service() { return drive_service_.get(); }
DebugInfoCollector* debug_info_collector() {
return debug_info_collector_.get();
}
FileSystemInterface* file_system() { return file_system_.get(); } FileSystemInterface* file_system() { return file_system_.get(); }
JobListInterface* job_list() { return scheduler_.get(); } JobListInterface* job_list() { return scheduler_.get(); }
...@@ -279,7 +275,6 @@ class DriveIntegrationService : public KeyedService, ...@@ -279,7 +275,6 @@ class DriveIntegrationService : public KeyedService,
std::unique_ptr<internal::ResourceMetadata, util::DestroyHelper> std::unique_ptr<internal::ResourceMetadata, util::DestroyHelper>
resource_metadata_; resource_metadata_;
std::unique_ptr<FileSystemInterface> file_system_; std::unique_ptr<FileSystemInterface> file_system_;
std::unique_ptr<DebugInfoCollector> debug_info_collector_;
base::ObserverList<DriveIntegrationServiceObserver>::Unchecked observers_; base::ObserverList<DriveIntegrationServiceObserver>::Unchecked observers_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment