Destroy icon manager after file thread is destroyed
This commit is contained in:
parent
977abc6458
commit
5687f8b3b7
4 changed files with 24 additions and 12 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "brightray/browser/brightray_paths.h"
|
#include "brightray/browser/brightray_paths.h"
|
||||||
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/icon_manager.h"
|
#include "chrome/browser/icon_manager.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "content/public/browser/browser_accessibility_state.h"
|
#include "content/public/browser/browser_accessibility_state.h"
|
||||||
|
@ -890,18 +891,16 @@ void App::GetFileIcon(const base::FilePath& path,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!icon_manager_.get()) {
|
auto icon_manager = g_browser_process->GetIconManager();
|
||||||
icon_manager_.reset(new IconManager());
|
gfx::Image* icon =
|
||||||
}
|
icon_manager->LookupIconFromFilepath(normalized_path, icon_size);
|
||||||
|
|
||||||
gfx::Image* icon = icon_manager_->LookupIconFromFilepath(normalized_path,
|
|
||||||
icon_size);
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
callback.Run(v8::Null(isolate()), *icon);
|
callback.Run(v8::Null(isolate()), *icon);
|
||||||
} else {
|
} else {
|
||||||
icon_manager_->LoadIcon(normalized_path, icon_size,
|
icon_manager->LoadIcon(
|
||||||
base::Bind(&OnIconDataAvailable, isolate(),
|
normalized_path, icon_size,
|
||||||
callback), &cancelable_task_tracker_);
|
base::Bind(&OnIconDataAvailable, isolate(), callback),
|
||||||
|
&cancelable_task_tracker_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,8 +130,6 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
void DisableHardwareAcceleration(mate::Arguments* args);
|
void DisableHardwareAcceleration(mate::Arguments* args);
|
||||||
bool IsAccessibilitySupportEnabled();
|
bool IsAccessibilitySupportEnabled();
|
||||||
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
|
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
|
||||||
base::CancelableTaskTracker cancelable_task_tracker_;
|
|
||||||
std::unique_ptr<IconManager> icon_manager_;
|
|
||||||
#if defined(USE_NSS_CERTS)
|
#if defined(USE_NSS_CERTS)
|
||||||
void ImportCertificate(const base::DictionaryValue& options,
|
void ImportCertificate(const base::DictionaryValue& options,
|
||||||
const net::CompletionCallback& callback);
|
const net::CompletionCallback& callback);
|
||||||
|
@ -153,6 +151,9 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
std::unique_ptr<CertificateManagerModel> certificate_manager_model_;
|
std::unique_ptr<CertificateManagerModel> certificate_manager_model_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Tracks tasks requesting file icons.
|
||||||
|
base::CancelableTaskTracker cancelable_task_tracker_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(App);
|
DISALLOW_COPY_AND_ASSIGN(App);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
|
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
|
|
||||||
|
#include "chrome/browser/icon_manager.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
|
||||||
BrowserProcess* g_browser_process = NULL;
|
BrowserProcess* g_browser_process = NULL;
|
||||||
|
|
||||||
BrowserProcess::BrowserProcess()
|
BrowserProcess::BrowserProcess()
|
||||||
: print_job_manager_(new printing::PrintJobManager) {
|
: print_job_manager_(new printing::PrintJobManager),
|
||||||
|
icon_manager_(new IconManager) {
|
||||||
g_browser_process = this;
|
g_browser_process = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +24,12 @@ std::string BrowserProcess::GetApplicationLocale() {
|
||||||
return l10n_util::GetApplicationLocale("");
|
return l10n_util::GetApplicationLocale("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconManager* BrowserProcess::GetIconManager() {
|
||||||
|
if (!icon_manager_.get())
|
||||||
|
icon_manager_.reset(new IconManager);
|
||||||
|
return icon_manager_.get();
|
||||||
|
}
|
||||||
|
|
||||||
printing::PrintJobManager* BrowserProcess::print_job_manager() {
|
printing::PrintJobManager* BrowserProcess::print_job_manager() {
|
||||||
return print_job_manager_.get();
|
return print_job_manager_.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
|
|
||||||
|
class IconManager;
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
class PrintJobManager;
|
class PrintJobManager;
|
||||||
}
|
}
|
||||||
|
@ -27,11 +29,13 @@ class BrowserProcess {
|
||||||
~BrowserProcess();
|
~BrowserProcess();
|
||||||
|
|
||||||
std::string GetApplicationLocale();
|
std::string GetApplicationLocale();
|
||||||
|
IconManager* GetIconManager();
|
||||||
|
|
||||||
printing::PrintJobManager* print_job_manager();
|
printing::PrintJobManager* print_job_manager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
|
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
|
||||||
|
std::unique_ptr<IconManager> icon_manager_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
|
DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue