Index: chrome/browser/bookmarks/bookmark_html_writer.cc |
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc |
index c95e150b0f8b0a6b7ee183a3e1f7b4301914a978..df55855046e679d38934e18993c7eb0cf1a6e3bc 100644 |
--- a/chrome/browser/bookmarks/bookmark_html_writer.cc |
+++ b/chrome/browser/bookmarks/bookmark_html_writer.cc |
@@ -42,7 +42,7 @@ using content::BrowserThread; |
namespace { |
-static BookmarkFaviconFetcher* fetcher = NULL; |
+BookmarkFaviconFetcher* g_fetcher = nullptr; |
// File header. |
const char kHeader[] = |
@@ -423,9 +423,10 @@ void BookmarkFaviconFetcher::Observe( |
int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
- if (chrome::NOTIFICATION_PROFILE_DESTROYED == type && fetcher != NULL) { |
- base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, fetcher); |
- fetcher = NULL; |
+ DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
+ if (g_fetcher) { |
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, g_fetcher); |
+ g_fetcher = nullptr; |
} |
} |
@@ -451,9 +452,9 @@ void BookmarkFaviconFetcher::ExecuteWriter() { |
new Writer(codec.Encode(BookmarkModelFactory::GetForProfile( |
profile_)), |
path_, favicons_map_.release(), observer_))); |
- if (fetcher != NULL) { |
- base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, fetcher); |
- fetcher = NULL; |
+ if (g_fetcher) { |
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, g_fetcher); |
+ g_fetcher = nullptr; |
} |
} |
@@ -510,9 +511,9 @@ void WriteBookmarks(Profile* profile, |
// BookmarkModel isn't thread safe (nor would we want to lock it down |
// for the duration of the write), as such we make a copy of the |
// BookmarkModel using BookmarkCodec then write from that. |
- if (fetcher == NULL) { |
- fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
- fetcher->ExportBookmarks(); |
+ if (!g_fetcher) { |
+ g_fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
+ g_fetcher->ExportBookmarks(); |
} |
} |