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

Side by Side Diff: storage/browser/fileapi/task_runner_bound_observer_list.h

Issue 809553005: Using "static_assert" in lieu of "COMPILE_ASSERT" in storage module (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_ 5 #ifndef STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
6 #define STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_ 6 #define STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::SequencedTaskRunner* runner_to_notify) const { 57 base::SequencedTaskRunner* runner_to_notify) const {
58 ObserversListMap observers = observers_; 58 ObserversListMap observers = observers_;
59 observers.insert(std::make_pair(observer, runner_to_notify)); 59 observers.insert(std::make_pair(observer, runner_to_notify));
60 return TaskRunnerBoundObserverList<Observer, ObserverStoreType>(observers); 60 return TaskRunnerBoundObserverList<Observer, ObserverStoreType>(observers);
61 } 61 }
62 62
63 // Notify on the task runner that is given to AddObserver. 63 // Notify on the task runner that is given to AddObserver.
64 // If we're already on the runner this just dispatches the method. 64 // If we're already on the runner this just dispatches the method.
65 template <class Method, class Params> 65 template <class Method, class Params>
66 void Notify(Method method, const Params& params) const { 66 void Notify(Method method, const Params& params) const {
67 COMPILE_ASSERT( 67 static_assert(
68 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), 68 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value),
69 badunboundmethodparams); 69 "bad unbound method params");
70 for (typename ObserversListMap::const_iterator it = observers_.begin(); 70 for (typename ObserversListMap::const_iterator it = observers_.begin();
71 it != observers_.end(); ++it) { 71 it != observers_.end(); ++it) {
72 if (!it->second.get() || it->second->RunsTasksOnCurrentThread()) { 72 if (!it->second.get() || it->second->RunsTasksOnCurrentThread()) {
73 DispatchToMethod(UnwrapTraits::Unwrap(it->first), method, params); 73 DispatchToMethod(UnwrapTraits::Unwrap(it->first), method, params);
74 continue; 74 continue;
75 } 75 }
76 it->second->PostTask( 76 it->second->PostTask(
77 FROM_HERE, 77 FROM_HERE,
78 base::Bind(&NotifyWrapper<ObserverStoreType, Method, Params>, 78 base::Bind(&NotifyWrapper<ObserverStoreType, Method, Params>,
79 it->first, method, params)); 79 it->first, method, params));
(...skipping 10 matching lines...) Expand all
90 class FileChangeObserver; 90 class FileChangeObserver;
91 class FileUpdateObserver; 91 class FileUpdateObserver;
92 92
93 typedef TaskRunnerBoundObserverList<FileAccessObserver> AccessObserverList; 93 typedef TaskRunnerBoundObserverList<FileAccessObserver> AccessObserverList;
94 typedef TaskRunnerBoundObserverList<FileChangeObserver> ChangeObserverList; 94 typedef TaskRunnerBoundObserverList<FileChangeObserver> ChangeObserverList;
95 typedef TaskRunnerBoundObserverList<FileUpdateObserver> UpdateObserverList; 95 typedef TaskRunnerBoundObserverList<FileUpdateObserver> UpdateObserverList;
96 96
97 } // namespace storage 97 } // namespace storage
98 98
99 #endif // STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_ 99 #endif // STORAGE_BROWSER_FILEAPI_TASK_RUNNER_BOUND_OBSERVER_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698