OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_html_writer.h" | 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 void BookmarkFaviconFetcher::ExecuteWriter() { | 447 void BookmarkFaviconFetcher::ExecuteWriter() { |
448 // BookmarkModel isn't thread safe (nor would we want to lock it down | 448 // BookmarkModel isn't thread safe (nor would we want to lock it down |
449 // for the duration of the write), as such we make a copy of the | 449 // for the duration of the write), as such we make a copy of the |
450 // BookmarkModel using BookmarkCodec then write from that. | 450 // BookmarkModel using BookmarkCodec then write from that. |
451 BookmarkCodec codec; | 451 BookmarkCodec codec; |
452 BrowserThread::PostTask( | 452 BrowserThread::PostTask( |
453 BrowserThread::FILE, FROM_HERE, | 453 BrowserThread::FILE, FROM_HERE, |
454 base::Bind( | 454 base::BindOnce( |
455 &Writer::DoWrite, | 455 &Writer::DoWrite, |
456 new Writer(codec.Encode( | 456 new Writer(codec.Encode( |
457 BookmarkModelFactory::GetForBrowserContext(profile_)), | 457 BookmarkModelFactory::GetForBrowserContext(profile_)), |
458 path_, favicons_map_.release(), observer_))); | 458 path_, favicons_map_.release(), observer_))); |
459 if (g_fetcher) { | 459 if (g_fetcher) { |
460 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, g_fetcher); | 460 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, g_fetcher); |
461 g_fetcher = nullptr; | 461 g_fetcher = nullptr; |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // BookmarkModel isn't thread safe (nor would we want to lock it down | 515 // BookmarkModel isn't thread safe (nor would we want to lock it down |
516 // for the duration of the write), as such we make a copy of the | 516 // for the duration of the write), as such we make a copy of the |
517 // BookmarkModel using BookmarkCodec then write from that. | 517 // BookmarkModel using BookmarkCodec then write from that. |
518 if (!g_fetcher) { | 518 if (!g_fetcher) { |
519 g_fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 519 g_fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
520 g_fetcher->ExportBookmarks(); | 520 g_fetcher->ExportBookmarks(); |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 } // namespace bookmark_html_writer | 524 } // namespace bookmark_html_writer |
OLD | NEW |