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

Unified Diff: content/browser/notification_service_impl.cc

Issue 11274038: content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win - part2 Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/notification_service_impl.h ('k') | content/browser/notification_service_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/notification_service_impl.cc
diff --git a/content/browser/notification_service_impl.cc b/content/browser/notification_service_impl.cc
index 2c6fa06636517bc11fd2f40e4ebd7483d47db2aa..01e4211df091cdb1d85802a3e2d9d23ec6d64dd9 100644
--- a/content/browser/notification_service_impl.cc
+++ b/content/browser/notification_service_impl.cc
@@ -9,6 +9,8 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_types.h"
+namespace content {
+
static base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> >
lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER;
@@ -18,18 +20,18 @@ NotificationServiceImpl* NotificationServiceImpl::current() {
}
// static
-content::NotificationService* content::NotificationService::current() {
+NotificationService* NotificationService::current() {
return NotificationServiceImpl::current();
}
// static
-content::NotificationService* content::NotificationService::Create() {
+NotificationService* NotificationService::Create() {
return new NotificationServiceImpl;
}
// static
bool NotificationServiceImpl::HasKey(const NotificationSourceMap& map,
- const content::NotificationSource& source) {
+ const NotificationSource& source) {
return map.find(source.map_key()) != map.end();
}
@@ -38,10 +40,9 @@ NotificationServiceImpl::NotificationServiceImpl() {
lazy_tls_ptr.Pointer()->Set(this);
}
-void NotificationServiceImpl::AddObserver(
- content::NotificationObserver* observer,
- int type,
- const content::NotificationSource& source) {
+void NotificationServiceImpl::AddObserver(NotificationObserver* observer,
+ int type,
+ const NotificationSource& source) {
// We have gotten some crashes where the observer pointer is NULL. The problem
// is that this happens when we actually execute a notification, so have no
// way of knowing who the bad observer was. We want to know when this happens
@@ -63,10 +64,9 @@ void NotificationServiceImpl::AddObserver(
#endif
}
-void NotificationServiceImpl::RemoveObserver(
- content::NotificationObserver* observer,
- int type,
- const content::NotificationSource& source) {
+void NotificationServiceImpl::RemoveObserver(NotificationObserver* observer,
+ int type,
+ const NotificationSource& source) {
// This is a very serious bug. An object is most likely being deleted on
// the wrong thread, and as a result another thread's NotificationServiceImpl
// has its deleted pointer in its map. A garbge object will be called in the
@@ -89,42 +89,41 @@ void NotificationServiceImpl::RemoveObserver(
}
}
-void NotificationServiceImpl::Notify(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK(type > content::NOTIFICATION_ALL) <<
+void NotificationServiceImpl::Notify(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type > NOTIFICATION_ALL) <<
"Allowed for observing, but not posting.";
// There's no particular reason for the order in which the different
// classes of observers get notified here.
// Notify observers of all types and all sources
- if (HasKey(observers_[content::NOTIFICATION_ALL], AllSources()) &&
+ if (HasKey(observers_[NOTIFICATION_ALL], AllSources()) &&
source != AllSources()) {
- FOR_EACH_OBSERVER(content::NotificationObserver,
- *observers_[content::NOTIFICATION_ALL][AllSources().map_key()],
+ FOR_EACH_OBSERVER(NotificationObserver,
+ *observers_[NOTIFICATION_ALL][AllSources().map_key()],
Observe(type, source, details));
}
// Notify observers of all types and the given source
- if (HasKey(observers_[content::NOTIFICATION_ALL], source)) {
- FOR_EACH_OBSERVER(content::NotificationObserver,
- *observers_[content::NOTIFICATION_ALL][source.map_key()],
+ if (HasKey(observers_[NOTIFICATION_ALL], source)) {
+ FOR_EACH_OBSERVER(NotificationObserver,
+ *observers_[NOTIFICATION_ALL][source.map_key()],
Observe(type, source, details));
}
// Notify observers of the given type and all sources
if (HasKey(observers_[type], AllSources()) &&
source != AllSources()) {
- FOR_EACH_OBSERVER(content::NotificationObserver,
+ FOR_EACH_OBSERVER(NotificationObserver,
*observers_[type][AllSources().map_key()],
Observe(type, source, details));
}
// Notify observers of the given type and the given source
if (HasKey(observers_[type], source)) {
- FOR_EACH_OBSERVER(content::NotificationObserver,
+ FOR_EACH_OBSERVER(NotificationObserver,
*observers_[type][source.map_key()],
Observe(type, source, details));
}
@@ -152,3 +151,5 @@ NotificationServiceImpl::~NotificationServiceImpl() {
delete it->second;
}
}
+
+} // namespace content
« no previous file with comments | « content/browser/notification_service_impl.h ('k') | content/browser/notification_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698