Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/media_galleries/fileapi/picasa_data_provider.cc

Issue 2438913003: Require FilePathWatcher destructor to be called in sequence with Watch(). (Closed)
Patch Set: CR thestig #36 (fix comment) Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media_galleries/fileapi/picasa_data_provider.h" 5 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); 44 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence();
45 45
46 StartFilePathWatchOnMediaTaskRunner( 46 StartFilePathWatchOnMediaTaskRunner(
47 database_path_.DirName().AppendASCII(kPicasaTempDirName), 47 database_path_.DirName().AppendASCII(kPicasaTempDirName),
48 base::Bind(&PicasaDataProvider::OnTempDirWatchStarted, 48 base::Bind(&PicasaDataProvider::OnTempDirWatchStarted,
49 weak_factory_.GetWeakPtr()), 49 weak_factory_.GetWeakPtr()),
50 base::Bind(&PicasaDataProvider::OnTempDirChanged, 50 base::Bind(&PicasaDataProvider::OnTempDirChanged,
51 weak_factory_.GetWeakPtr())); 51 weak_factory_.GetWeakPtr()));
52 } 52 }
53 53
54 PicasaDataProvider::~PicasaDataProvider() {} 54 PicasaDataProvider::~PicasaDataProvider() {
55 StopFilePathWatchOnMediaTaskRunner(std::move(temp_dir_watcher_));
56 }
55 57
56 void PicasaDataProvider::RefreshData(DataType needed_data, 58 void PicasaDataProvider::RefreshData(DataType needed_data,
57 const ReadyCallback& ready_callback) { 59 const ReadyCallback& ready_callback) {
58 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence(); 60 MediaFileSystemBackend::AssertCurrentlyOnMediaSequence();
59 // TODO(tommycli): Need to watch the database_path_ folder and handle 61 // TODO(tommycli): Need to watch the database_path_ folder and handle
60 // rereading the data when it changes. 62 // rereading the data when it changes.
61 63
62 if (state_ == INVALID_DATA_STATE) { 64 if (state_ == INVALID_DATA_STATE) {
63 ready_callback.Run(false /* success */); 65 ready_callback.Run(false /* success */);
64 return; 66 return;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (total_counts[name] != 1) { 260 if (total_counts[name] != 1) {
259 name = base::StringPrintf("%s (%d)", name.c_str(), 261 name = base::StringPrintf("%s (%d)", name.c_str(),
260 ++current_counts[name]); 262 ++current_counts[name]);
261 } 263 }
262 264
263 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i])); 265 result_map->insert(std::pair<std::string, AlbumInfo>(name, info_list[i]));
264 } 266 }
265 } 267 }
266 268
267 } // namespace picasa 269 } // namespace picasa
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc ('k') | chrome/common/service_process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698