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

Side by Side Diff: chrome/browser/policy/logging_work_scheduler.h

Issue 7941008: Cosmetic cleanups in chrome/browser/policy/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload was broken? Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_ 5 #ifndef CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_
6 #define CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_ 6 #define CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
13 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
16 #include "base/task.h"
14 #include "chrome/browser/policy/delayed_work_scheduler.h" 17 #include "chrome/browser/policy/delayed_work_scheduler.h"
15 18
16 // Utilities for testing users of DelayedWorkScheduler. There are no 19 // Utilities for testing users of DelayedWorkScheduler. There are no
17 // thread-safety guarantees for the classes in this file. They expect to 20 // thread-safety guarantees for the classes in this file. They expect to
18 // only be called from the UI thread and issue callbacks on that very same 21 // only be called from the UI thread and issue callbacks on that very same
19 // thread. 22 // thread.
20 // 23 //
21 // Usage examples: 24 // Usage examples:
22 // 25 //
23 // Making CloudPolicyController and/or DeviceTokenFetcher run without real-time 26 // Making CloudPolicyController and/or DeviceTokenFetcher run without real-time
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Issues delayed tasks with zero effective delay, but posts them through 104 // Issues delayed tasks with zero effective delay, but posts them through
102 // an EventLogger, to make it possible to log events and reconstruct their 105 // an EventLogger, to make it possible to log events and reconstruct their
103 // execution time. 106 // execution time.
104 class LoggingWorkScheduler : public DelayedWorkScheduler { 107 class LoggingWorkScheduler : public DelayedWorkScheduler {
105 public: 108 public:
106 // An EventLogger may be shared by more than one schedulers, therefore 109 // An EventLogger may be shared by more than one schedulers, therefore
107 // no ownership is taken. 110 // no ownership is taken.
108 explicit LoggingWorkScheduler(EventLogger* logger); 111 explicit LoggingWorkScheduler(EventLogger* logger);
109 virtual ~LoggingWorkScheduler(); 112 virtual ~LoggingWorkScheduler();
110 113
111 virtual void PostDelayedWork(const base::Closure& callback, int64 delay); 114 virtual void PostDelayedWork(const base::Closure& callback, int64 delay)
112 virtual void CancelDelayedWork(); 115 OVERRIDE;
116 virtual void CancelDelayedWork() OVERRIDE;
113 117
114 private: 118 private:
115 EventLogger* logger_; 119 EventLogger* logger_;
116 linked_ptr<base::Closure> callback_; 120 linked_ptr<base::Closure> callback_;
117 121
118 DISALLOW_COPY_AND_ASSIGN(LoggingWorkScheduler); 122 DISALLOW_COPY_AND_ASSIGN(LoggingWorkScheduler);
119 }; 123 };
120 124
121 // This implementation of DelayedWorkScheduler always schedules the tasks 125 // This implementation of DelayedWorkScheduler always schedules the tasks
122 // with zero delay. 126 // with zero delay.
123 class DummyWorkScheduler : public DelayedWorkScheduler { 127 class DummyWorkScheduler : public DelayedWorkScheduler {
124 public: 128 public:
125 DummyWorkScheduler(); 129 DummyWorkScheduler();
126 virtual ~DummyWorkScheduler(); 130 virtual ~DummyWorkScheduler();
127 131
128 virtual void PostDelayedWork(const base::Closure& callback, int64 delay); 132 virtual void PostDelayedWork(const base::Closure& callback, int64 delay)
133 OVERRIDE;
129 134
130 private: 135 private:
131 DISALLOW_COPY_AND_ASSIGN(DummyWorkScheduler); 136 DISALLOW_COPY_AND_ASSIGN(DummyWorkScheduler);
132 }; 137 };
133 138
134 } // namespace policy 139 } // namespace policy
135 140
136 #endif // CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_ 141 #endif // CHROME_BROWSER_POLICY_LOGGING_WORK_SCHEDULER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/file_based_policy_provider_unittest.cc ('k') | chrome/browser/policy/logging_work_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698