build: remove //chrome/browser/icon_loader source copies (#14955)

* build: remove //chrome/browser/icon_loader source copies

* chore: add DCHECK to ensure IconManager is accessed from UI thread
This commit is contained in:
Robo 2018-10-06 00:42:53 +05:30 committed by Charles Kerr
parent 71058fd9a3
commit 2700eaca1e
17 changed files with 25 additions and 560 deletions

View file

@ -1100,7 +1100,7 @@ void App::GetFileIcon(const base::FilePath& path, mate::Arguments* args) {
return;
}
auto* icon_manager = g_browser_process->GetIconManager();
auto* icon_manager = AtomBrowserMainParts::Get()->GetIconManager();
gfx::Image* icon =
icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
if (icon) {

View file

@ -21,6 +21,7 @@
#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/net/chrome_net_log_helper.h"
#include "components/net_log/chrome_net_log.h"
#include "components/net_log/net_export_file_writer.h"
@ -309,4 +310,11 @@ AtomBrowserMainParts::GetGeolocationControl() {
return geolocation_control_.get();
}
IconManager* AtomBrowserMainParts::GetIconManager() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!icon_manager_.get())
icon_manager_.reset(new IconManager);
return icon_manager_.get();
}
} // namespace atom

View file

@ -17,6 +17,7 @@
#include "services/device/public/mojom/geolocation_control.mojom.h"
class BrowserProcess;
class IconManager;
#if defined(TOOLKIT_VIEWS)
namespace brightray {
@ -65,6 +66,9 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
// used to enable the location services once per client.
device::mojom::GeolocationControl* GetGeolocationControl();
// Returns handle to the class responsible for extracting file icons.
IconManager* GetIconManager();
Browser* browser() { return browser_.get(); }
IOThread* io_thread() const { return io_thread_.get(); }
net_log::ChromeNetLog* net_log() { return net_log_.get(); }
@ -119,6 +123,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
std::unique_ptr<NodeDebugger> node_debugger_;
std::unique_ptr<IOThread> io_thread_;
std::unique_ptr<net_log::ChromeNetLog> net_log_;
std::unique_ptr<IconManager> icon_manager_;
base::Timer gc_timer_;