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

Side by Side Diff: chrome/browser/sync/util/extensions_activity_monitor.cc

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/sync/util/extensions_activity_monitor.h" 5 #include "chrome/browser/sync/util/extensions_activity_monitor.h"
6 6
7 #include "base/task.h" 7 #include "base/task.h"
8 #include "chrome/browser/browser_thread.h" 8 #include "chrome/browser/browser_thread.h"
9 #include "chrome/browser/extensions/extension_bookmarks_module.h" 9 #include "chrome/browser/extensions/extension_bookmarks_module.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
59 59
60 // The registrar calls RemoveAll in its dtor (which would happen in a 60 // The registrar calls RemoveAll in its dtor (which would happen in a
61 // moment but explicitly call this so it is clear why we need to be on the 61 // moment but explicitly call this so it is clear why we need to be on the
62 // ui_loop_. 62 // ui_loop_.
63 registrar_.RemoveAll(); 63 registrar_.RemoveAll();
64 } 64 }
65 } 65 }
66 66
67 void ExtensionsActivityMonitor::GetAndClearRecords(Records* buffer) { 67 void ExtensionsActivityMonitor::GetAndClearRecords(Records* buffer) {
68 AutoLock lock(records_lock_); 68 base::AutoLock lock(records_lock_);
69 buffer->clear(); 69 buffer->clear();
70 buffer->swap(records_); 70 buffer->swap(records_);
71 } 71 }
72 72
73 void ExtensionsActivityMonitor::PutRecords(const Records& records) { 73 void ExtensionsActivityMonitor::PutRecords(const Records& records) {
74 AutoLock lock(records_lock_); 74 base::AutoLock lock(records_lock_);
75 for (Records::const_iterator i = records.begin(); i != records.end(); ++i) { 75 for (Records::const_iterator i = records.begin(); i != records.end(); ++i) {
76 records_[i->first].extension_id = i->second.extension_id; 76 records_[i->first].extension_id = i->second.extension_id;
77 records_[i->first].bookmark_write_count += i->second.bookmark_write_count; 77 records_[i->first].bookmark_write_count += i->second.bookmark_write_count;
78 } 78 }
79 } 79 }
80 80
81 void ExtensionsActivityMonitor::Observe(NotificationType type, 81 void ExtensionsActivityMonitor::Observe(NotificationType type,
82 const NotificationSource& source, 82 const NotificationSource& source,
83 const NotificationDetails& details) { 83 const NotificationDetails& details) {
84 AutoLock lock(records_lock_); 84 base::AutoLock lock(records_lock_);
85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
86 const Extension* extension = Source<const Extension>(source).ptr(); 86 const Extension* extension = Source<const Extension>(source).ptr();
87 const BookmarksFunction* f = Details<const BookmarksFunction>(details).ptr(); 87 const BookmarksFunction* f = Details<const BookmarksFunction>(details).ptr();
88 if (f->name() == "bookmarks.update" || 88 if (f->name() == "bookmarks.update" ||
89 f->name() == "bookmarks.move" || 89 f->name() == "bookmarks.move" ||
90 f->name() == "bookmarks.create" || 90 f->name() == "bookmarks.create" ||
91 f->name() == "bookmarks.removeTree" || 91 f->name() == "bookmarks.removeTree" ||
92 f->name() == "bookmarks.remove") { 92 f->name() == "bookmarks.remove") {
93 Record& record = records_[extension->id()]; 93 Record& record = records_[extension->id()];
94 record.extension_id = extension->id(); 94 record.extension_id = extension->id();
95 record.bookmark_write_count++; 95 record.bookmark_write_count++;
96 } 96 }
97 } 97 }
98 98
99 } // namespace browser_sync 99 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/extensions_activity_monitor.h ('k') | chrome/browser/sync/util/user_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698