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

Side by Side Diff: base/thread_pool_callback.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « base/thread_pool.cc ('k') | base/thread_pool_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2004-2010 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #ifndef OMAHA_BASE_THREAD_POOL_CALLBACK_H_
17 #define OMAHA_BASE_THREAD_POOL_CALLBACK_H_
18
19 #include <windows.h>
20 #include "base/basictypes.h"
21 #include "omaha/base/thread_pool.h"
22
23 namespace omaha {
24
25 template <typename T>
26 class ThreadPoolCallBack0 : public UserWorkItem {
27 public:
28 explicit ThreadPoolCallBack0(T* obj, void (T::*fun)())
29 : obj_(obj), fun_(fun) {}
30 private:
31 virtual void DoProcess() {
32 (obj_->*fun_)();
33 }
34 T* obj_;
35 void (T::*fun_)();
36
37 DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack0);
38 };
39
40 template <typename T, typename P1>
41 class ThreadPoolCallBack1 : public UserWorkItem {
42 public:
43 explicit ThreadPoolCallBack1(T* obj, void (T::*fun)(P1), P1 p1)
44 : obj_(obj), fun_(fun), p1_(p1) {}
45 private:
46 virtual void DoProcess() {
47 (obj_->*fun_)(p1_);
48 }
49 T* obj_;
50 void (T::*fun_)(P1);
51 P1 p1_;
52
53 DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack1);
54 };
55
56 template <typename P1>
57 class StaticThreadPoolCallBack1 : public UserWorkItem {
58 public:
59 explicit StaticThreadPoolCallBack1(void (*fun)(P1), P1 p1)
60 : fun_(fun), p1_(p1) {}
61 private:
62 virtual void DoProcess() {
63 (*fun_)(p1_);
64 }
65
66 void (*fun_)(P1);
67 P1 p1_;
68
69 DISALLOW_COPY_AND_ASSIGN(StaticThreadPoolCallBack1);
70 };
71
72 template <typename T, typename P1, typename P2>
73 class ThreadPoolCallBack2 : public UserWorkItem {
74 public:
75 explicit ThreadPoolCallBack2(T* obj, void (T::*fun)(P1, P2), P1 p1, P2 p2)
76 : obj_(obj), fun_(fun), p1_(p1), p2_(p2) {}
77 private:
78 virtual void DoProcess() {
79 (obj_->*fun_)(p1_, p2_);
80 }
81 T* obj_;
82 void (T::*fun_)(P1, P2);
83 P1 p1_;
84 P2 p2_;
85
86 DISALLOW_COPY_AND_ASSIGN(ThreadPoolCallBack2);
87 };
88
89 } // namespace omaha
90
91 #endif // OMAHA_BASE_THREAD_POOL_CALLBACK_H_
92
OLDNEW
« no previous file with comments | « base/thread_pool.cc ('k') | base/thread_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698