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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/gallery_watch_manager.cc

Issue 216513002: Replace DCHECK(BrowserThread::CurrentlyOn) with DCHECK_CURRENTLY_ON in extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 | Annotate | Revision Log
OLDNEW
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 // GalleryWatchManager implementation. 5 // GalleryWatchManager implementation.
6 6
7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_ma nager.h" 7 #include "chrome/browser/extensions/api/media_galleries_private/gallery_watch_ma nager.h"
8 8
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 20 matching lines...) Expand all
31 // Value: GalleryWatchManager*. 31 // Value: GalleryWatchManager*.
32 // This map owns the GalleryWatchManager object. 32 // This map owns the GalleryWatchManager object.
33 typedef std::map<void*, extensions::GalleryWatchManager*> WatchManagerMap; 33 typedef std::map<void*, extensions::GalleryWatchManager*> WatchManagerMap;
34 WatchManagerMap* g_gallery_watch_managers = NULL; 34 WatchManagerMap* g_gallery_watch_managers = NULL;
35 35
36 // Dispatches the gallery changed event on the UI thread. 36 // Dispatches the gallery changed event on the UI thread.
37 void SendGalleryChangedEventOnUIThread( 37 void SendGalleryChangedEventOnUIThread(
38 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router, 38 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router,
39 MediaGalleryPrefId gallery_id, 39 MediaGalleryPrefId gallery_id,
40 const std::set<std::string>& extension_ids) { 40 const std::set<std::string>& extension_ids) {
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 41 DCHECK_CURRENTLY_ON(BrowserThread::UI);
42 if (event_router.get()) 42 if (event_router.get())
43 event_router->OnGalleryChanged(gallery_id, extension_ids); 43 event_router->OnGalleryChanged(gallery_id, extension_ids);
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 /////////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////////
49 // GalleryWatchManager::GalleryFilePathWatcher // 49 // GalleryWatchManager::GalleryFilePathWatcher //
50 /////////////////////////////////////////////////////////////////////////////// 50 ///////////////////////////////////////////////////////////////////////////////
51 51
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 GalleryWatchManager::GalleryFilePathWatcher::GalleryFilePathWatcher( 127 GalleryWatchManager::GalleryFilePathWatcher::GalleryFilePathWatcher(
128 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router, 128 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router,
129 MediaGalleryPrefId gallery_id, 129 MediaGalleryPrefId gallery_id,
130 const base::FilePath& path, 130 const base::FilePath& path,
131 const std::string& extension_id, 131 const std::string& extension_id,
132 const base::Closure& on_destroyed_callback) 132 const base::Closure& on_destroyed_callback)
133 : event_router_(event_router), 133 : event_router_(event_router),
134 gallery_id_(gallery_id), 134 gallery_id_(gallery_id),
135 on_destroyed_callback_(on_destroyed_callback), 135 on_destroyed_callback_(on_destroyed_callback),
136 weak_ptr_factory_(this) { 136 weak_ptr_factory_(this) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 137 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
138 gallery_path_ = path; 138 gallery_path_ = path;
139 AddExtension(extension_id); 139 AddExtension(extension_id);
140 } 140 }
141 141
142 void GalleryWatchManager::GalleryFilePathWatcher::AddExtension( 142 void GalleryWatchManager::GalleryFilePathWatcher::AddExtension(
143 const std::string& extension_id) { 143 const std::string& extension_id) {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 144 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
145 if (ContainsKey(extension_watch_info_map_, extension_id)) 145 if (ContainsKey(extension_watch_info_map_, extension_id))
146 return; 146 return;
147 extension_watch_info_map_[extension_id] = base::Time(); 147 extension_watch_info_map_[extension_id] = base::Time();
148 AddRef(); 148 AddRef();
149 } 149 }
150 150
151 void GalleryWatchManager::GalleryFilePathWatcher::RemoveExtension( 151 void GalleryWatchManager::GalleryFilePathWatcher::RemoveExtension(
152 const std::string& extension_id) { 152 const std::string& extension_id) {
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 153 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
154 if (extension_watch_info_map_.erase(extension_id) == 1) 154 if (extension_watch_info_map_.erase(extension_id) == 1)
155 Release(); 155 Release();
156 } 156 }
157 157
158 void GalleryWatchManager::GalleryFilePathWatcher::OnExtensionUnloaded( 158 void GalleryWatchManager::GalleryFilePathWatcher::OnExtensionUnloaded(
159 const std::string& extension_id) { 159 const std::string& extension_id) {
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 160 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
161 RemoveExtensionReferences(extension_id); 161 RemoveExtensionReferences(extension_id);
162 } 162 }
163 163
164 bool GalleryWatchManager::GalleryFilePathWatcher::SetupWatch() { 164 bool GalleryWatchManager::GalleryFilePathWatcher::SetupWatch() {
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 165 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
166 return file_watcher_.Watch( 166 return file_watcher_.Watch(
167 gallery_path_, true, 167 gallery_path_, true,
168 base::Bind(&GalleryFilePathWatcher::OnFilePathChanged, 168 base::Bind(&GalleryFilePathWatcher::OnFilePathChanged,
169 weak_ptr_factory_.GetWeakPtr())); 169 weak_ptr_factory_.GetWeakPtr()));
170 } 170 }
171 171
172 void GalleryWatchManager::GalleryFilePathWatcher::RemoveAllWatchReferences() { 172 void GalleryWatchManager::GalleryFilePathWatcher::RemoveAllWatchReferences() {
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 173 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
174 std::set<std::string> extension_ids; 174 std::set<std::string> extension_ids;
175 for (ExtensionWatchInfoMap::iterator iter = extension_watch_info_map_.begin(); 175 for (ExtensionWatchInfoMap::iterator iter = extension_watch_info_map_.begin();
176 iter != extension_watch_info_map_.end(); ++iter) 176 iter != extension_watch_info_map_.end(); ++iter)
177 extension_ids.insert(iter->first); 177 extension_ids.insert(iter->first);
178 178
179 for (std::set<std::string>::const_iterator it = extension_ids.begin(); 179 for (std::set<std::string>::const_iterator it = extension_ids.begin();
180 it != extension_ids.end(); ++it) 180 it != extension_ids.end(); ++it)
181 RemoveExtensionReferences(*it); 181 RemoveExtensionReferences(*it);
182 } 182 }
183 183
184 GalleryWatchManager::GalleryFilePathWatcher::~GalleryFilePathWatcher() { 184 GalleryWatchManager::GalleryFilePathWatcher::~GalleryFilePathWatcher() {
185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 185 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
186 on_destroyed_callback_.Run(); 186 on_destroyed_callback_.Run();
187 } 187 }
188 188
189 void GalleryWatchManager::GalleryFilePathWatcher::OnFilePathChanged( 189 void GalleryWatchManager::GalleryFilePathWatcher::OnFilePathChanged(
190 const base::FilePath& path, 190 const base::FilePath& path,
191 bool error) { 191 bool error) {
192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 192 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
193 if (error || (path != gallery_path_)) 193 if (error || (path != gallery_path_))
194 return; 194 return;
195 195
196 std::set<std::string> extension_ids; 196 std::set<std::string> extension_ids;
197 for (ExtensionWatchInfoMap::iterator iter = extension_watch_info_map_.begin(); 197 for (ExtensionWatchInfoMap::iterator iter = extension_watch_info_map_.begin();
198 iter != extension_watch_info_map_.end(); ++iter) { 198 iter != extension_watch_info_map_.end(); ++iter) {
199 if (!iter->second.is_null()) { 199 if (!iter->second.is_null()) {
200 // Ignore gallery change event if it is received too frequently. 200 // Ignore gallery change event if it is received too frequently.
201 // For example, when an user copies/deletes 1000 media files from a 201 // For example, when an user copies/deletes 1000 media files from a
202 // gallery, this callback is called 1000 times within a span of 10ms. 202 // gallery, this callback is called 1000 times within a span of 10ms.
(...skipping 10 matching lines...) Expand all
213 if (!extension_ids.empty()) { 213 if (!extension_ids.empty()) {
214 content::BrowserThread::PostTask( 214 content::BrowserThread::PostTask(
215 content::BrowserThread::UI, FROM_HERE, 215 content::BrowserThread::UI, FROM_HERE,
216 base::Bind(SendGalleryChangedEventOnUIThread, event_router_, 216 base::Bind(SendGalleryChangedEventOnUIThread, event_router_,
217 gallery_id_, extension_ids)); 217 gallery_id_, extension_ids));
218 } 218 }
219 } 219 }
220 220
221 void GalleryWatchManager::GalleryFilePathWatcher::RemoveExtensionReferences( 221 void GalleryWatchManager::GalleryFilePathWatcher::RemoveExtensionReferences(
222 const std::string& extension_id) { 222 const std::string& extension_id) {
223 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 223 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
224 ExtensionWatchInfoMap::iterator it = 224 ExtensionWatchInfoMap::iterator it =
225 extension_watch_info_map_.find(extension_id); 225 extension_watch_info_map_.find(extension_id);
226 if (it == extension_watch_info_map_.end()) 226 if (it == extension_watch_info_map_.end())
227 return; 227 return;
228 extension_watch_info_map_.erase(it); 228 extension_watch_info_map_.erase(it);
229 Release(); 229 Release();
230 } 230 }
231 231
232 /////////////////////////////////////////////////////////////////////////////// 232 ///////////////////////////////////////////////////////////////////////////////
233 // GalleryWatchManager // 233 // GalleryWatchManager //
234 /////////////////////////////////////////////////////////////////////////////// 234 ///////////////////////////////////////////////////////////////////////////////
235 235
236 // static 236 // static
237 GalleryWatchManager* GalleryWatchManager::GetForProfile( 237 GalleryWatchManager* GalleryWatchManager::GetForProfile(
238 void* profile_id) { 238 void* profile_id) {
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 239 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
240 DCHECK(profile_id); 240 DCHECK(profile_id);
241 bool has_watch_manager = (g_gallery_watch_managers && 241 bool has_watch_manager = (g_gallery_watch_managers &&
242 GalleryWatchManager::HasForProfile(profile_id)); 242 GalleryWatchManager::HasForProfile(profile_id));
243 if (!g_gallery_watch_managers) 243 if (!g_gallery_watch_managers)
244 g_gallery_watch_managers = new WatchManagerMap; 244 g_gallery_watch_managers = new WatchManagerMap;
245 if (!has_watch_manager) 245 if (!has_watch_manager)
246 (*g_gallery_watch_managers)[profile_id] = new GalleryWatchManager; 246 (*g_gallery_watch_managers)[profile_id] = new GalleryWatchManager;
247 return (*g_gallery_watch_managers)[profile_id]; 247 return (*g_gallery_watch_managers)[profile_id];
248 } 248 }
249 249
250 // static 250 // static
251 bool GalleryWatchManager::HasForProfile(void* profile_id) { 251 bool GalleryWatchManager::HasForProfile(void* profile_id) {
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 252 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
253 DCHECK(profile_id); 253 DCHECK(profile_id);
254 if (!g_gallery_watch_managers) 254 if (!g_gallery_watch_managers)
255 return false; 255 return false;
256 WatchManagerMap::const_iterator it = 256 WatchManagerMap::const_iterator it =
257 g_gallery_watch_managers->find(profile_id); 257 g_gallery_watch_managers->find(profile_id);
258 return (it != g_gallery_watch_managers->end()); 258 return (it != g_gallery_watch_managers->end());
259 } 259 }
260 260
261 // static 261 // static
262 void GalleryWatchManager::OnProfileShutdown(void* profile_id) { 262 void GalleryWatchManager::OnProfileShutdown(void* profile_id) {
263 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 263 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
264 DCHECK(profile_id); 264 DCHECK(profile_id);
265 if (!g_gallery_watch_managers || g_gallery_watch_managers->empty()) 265 if (!g_gallery_watch_managers || g_gallery_watch_managers->empty())
266 return; 266 return;
267 WatchManagerMap::iterator it = g_gallery_watch_managers->find(profile_id); 267 WatchManagerMap::iterator it = g_gallery_watch_managers->find(profile_id);
268 if (it == g_gallery_watch_managers->end()) 268 if (it == g_gallery_watch_managers->end())
269 return; 269 return;
270 delete it->second; 270 delete it->second;
271 g_gallery_watch_managers->erase(it); 271 g_gallery_watch_managers->erase(it);
272 if (g_gallery_watch_managers->empty()) 272 if (g_gallery_watch_managers->empty())
273 delete g_gallery_watch_managers; 273 delete g_gallery_watch_managers;
274 } 274 }
275 275
276 // static 276 // static
277 bool GalleryWatchManager::SetupGalleryWatch( 277 bool GalleryWatchManager::SetupGalleryWatch(
278 void* profile_id, 278 void* profile_id,
279 MediaGalleryPrefId gallery_id, 279 MediaGalleryPrefId gallery_id,
280 const base::FilePath& watch_path, 280 const base::FilePath& watch_path,
281 const std::string& extension_id, 281 const std::string& extension_id,
282 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router) { 282 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router) {
283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 283 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
284 return GalleryWatchManager::GetForProfile(profile_id)->StartGalleryWatch( 284 return GalleryWatchManager::GetForProfile(profile_id)->StartGalleryWatch(
285 gallery_id, watch_path, extension_id, event_router); 285 gallery_id, watch_path, extension_id, event_router);
286 } 286 }
287 287
288 // static 288 // static
289 void GalleryWatchManager::RemoveGalleryWatch(void* profile_id, 289 void GalleryWatchManager::RemoveGalleryWatch(void* profile_id,
290 const base::FilePath& watch_path, 290 const base::FilePath& watch_path,
291 const std::string& extension_id) { 291 const std::string& extension_id) {
292 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 292 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
293 if (!GalleryWatchManager::HasForProfile(profile_id)) 293 if (!GalleryWatchManager::HasForProfile(profile_id))
294 return; 294 return;
295 GalleryWatchManager::GetForProfile(profile_id)->StopGalleryWatch( 295 GalleryWatchManager::GetForProfile(profile_id)->StopGalleryWatch(
296 watch_path, extension_id); 296 watch_path, extension_id);
297 } 297 }
298 298
299 void GalleryWatchManager::OnExtensionUnloaded(void* profile_id, 299 void GalleryWatchManager::OnExtensionUnloaded(void* profile_id,
300 const std::string& extension_id) { 300 const std::string& extension_id) {
301 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 301 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
302 if (!GalleryWatchManager::HasForProfile(profile_id)) 302 if (!GalleryWatchManager::HasForProfile(profile_id))
303 return; 303 return;
304 GalleryWatchManager::GetForProfile(profile_id)->HandleExtensionUnloadedEvent( 304 GalleryWatchManager::GetForProfile(profile_id)->HandleExtensionUnloadedEvent(
305 extension_id); 305 extension_id);
306 } 306 }
307 307
308 GalleryWatchManager::GalleryWatchManager() { 308 GalleryWatchManager::GalleryWatchManager() {
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 309 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
310 } 310 }
311 311
312 GalleryWatchManager::~GalleryWatchManager() { 312 GalleryWatchManager::~GalleryWatchManager() {
313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 313 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
314 DeleteAllWatchers(); 314 DeleteAllWatchers();
315 } 315 }
316 316
317 bool GalleryWatchManager::StartGalleryWatch( 317 bool GalleryWatchManager::StartGalleryWatch(
318 MediaGalleryPrefId gallery_id, 318 MediaGalleryPrefId gallery_id,
319 const base::FilePath& watch_path, 319 const base::FilePath& watch_path,
320 const std::string& extension_id, 320 const std::string& extension_id,
321 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router) { 321 base::WeakPtr<MediaGalleriesPrivateEventRouter> event_router) {
322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 322 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
323 WatcherMap::const_iterator iter = gallery_watchers_.find(watch_path); 323 WatcherMap::const_iterator iter = gallery_watchers_.find(watch_path);
324 if (iter != gallery_watchers_.end()) { 324 if (iter != gallery_watchers_.end()) {
325 // Already watched. 325 // Already watched.
326 iter->second->AddExtension(extension_id); 326 iter->second->AddExtension(extension_id);
327 return true; 327 return true;
328 } 328 }
329 329
330 // Need to add a new watcher. 330 // Need to add a new watcher.
331 scoped_refptr<GalleryFilePathWatcher> watch( 331 scoped_refptr<GalleryFilePathWatcher> watch(
332 new GalleryFilePathWatcher( 332 new GalleryFilePathWatcher(
333 event_router, gallery_id, watch_path, extension_id, 333 event_router, gallery_id, watch_path, extension_id,
334 base::Bind(&GalleryWatchManager::RemoveGalleryFilePathWatcherEntry, 334 base::Bind(&GalleryWatchManager::RemoveGalleryFilePathWatcherEntry,
335 base::Unretained(this), 335 base::Unretained(this),
336 watch_path))); 336 watch_path)));
337 if (!watch->SetupWatch()) 337 if (!watch->SetupWatch())
338 return false; 338 return false;
339 gallery_watchers_[watch_path] = watch.get(); 339 gallery_watchers_[watch_path] = watch.get();
340 return true; 340 return true;
341 } 341 }
342 342
343 void GalleryWatchManager::StopGalleryWatch( 343 void GalleryWatchManager::StopGalleryWatch(
344 const base::FilePath& watch_path, 344 const base::FilePath& watch_path,
345 const std::string& extension_id) { 345 const std::string& extension_id) {
346 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 346 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
347 WatcherMap::iterator iter = gallery_watchers_.find(watch_path); 347 WatcherMap::iterator iter = gallery_watchers_.find(watch_path);
348 if (iter == gallery_watchers_.end()) 348 if (iter == gallery_watchers_.end())
349 return; 349 return;
350 // Remove the renderer process for this watch. 350 // Remove the renderer process for this watch.
351 iter->second->RemoveExtension(extension_id); 351 iter->second->RemoveExtension(extension_id);
352 } 352 }
353 353
354 void GalleryWatchManager::HandleExtensionUnloadedEvent( 354 void GalleryWatchManager::HandleExtensionUnloadedEvent(
355 const std::string& extension_id) { 355 const std::string& extension_id) {
356 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 356 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
357 std::list<base::FilePath> watchers_to_notify; 357 std::list<base::FilePath> watchers_to_notify;
358 for (WatcherMap::iterator iter = gallery_watchers_.begin(); 358 for (WatcherMap::iterator iter = gallery_watchers_.begin();
359 iter != gallery_watchers_.end(); ++iter) 359 iter != gallery_watchers_.end(); ++iter)
360 watchers_to_notify.push_back(iter->first); 360 watchers_to_notify.push_back(iter->first);
361 361
362 for (std::list<base::FilePath>::const_iterator path = 362 for (std::list<base::FilePath>::const_iterator path =
363 watchers_to_notify.begin(); 363 watchers_to_notify.begin();
364 path != watchers_to_notify.end(); ++path) { 364 path != watchers_to_notify.end(); ++path) {
365 WatcherMap::iterator iter = gallery_watchers_.find(*path); 365 WatcherMap::iterator iter = gallery_watchers_.find(*path);
366 if (iter == gallery_watchers_.end()) 366 if (iter == gallery_watchers_.end())
367 continue; 367 continue;
368 iter->second->OnExtensionUnloaded(extension_id); 368 iter->second->OnExtensionUnloaded(extension_id);
369 } 369 }
370 } 370 }
371 371
372 void GalleryWatchManager::DeleteAllWatchers() { 372 void GalleryWatchManager::DeleteAllWatchers() {
373 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 373 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
374 if (gallery_watchers_.empty()) 374 if (gallery_watchers_.empty())
375 return; 375 return;
376 376
377 // Create a copy of |gallery_watchers_| to delete because 377 // Create a copy of |gallery_watchers_| to delete because
378 // GalleryFilePathWatcher::RemoveAllWatchReferences will 378 // GalleryFilePathWatcher::RemoveAllWatchReferences will
379 // eventually call GalleryWatchManager::RemoveGalleryFilePathWatcherEntry() 379 // eventually call GalleryWatchManager::RemoveGalleryFilePathWatcherEntry()
380 // and modify |gallery_watchers_|. 380 // and modify |gallery_watchers_|.
381 WatcherMap watchers_to_delete(gallery_watchers_); 381 WatcherMap watchers_to_delete(gallery_watchers_);
382 for (WatcherMap::const_iterator iter = watchers_to_delete.begin(); 382 for (WatcherMap::const_iterator iter = watchers_to_delete.begin();
383 iter != watchers_to_delete.end(); ++iter) 383 iter != watchers_to_delete.end(); ++iter)
384 iter->second->RemoveAllWatchReferences(); 384 iter->second->RemoveAllWatchReferences();
385 } 385 }
386 386
387 void GalleryWatchManager::RemoveGalleryFilePathWatcherEntry( 387 void GalleryWatchManager::RemoveGalleryFilePathWatcherEntry(
388 const base::FilePath& watch_path) { 388 const base::FilePath& watch_path) {
389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 389 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
390 gallery_watchers_.erase(watch_path); 390 gallery_watchers_.erase(watch_path);
391 } 391 }
392 392
393 } // namespace extensions 393 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698