Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file contains the implementation shared by | |
| 6 // MessageLoopProxy::PostTaskAndReply and WorkerPool::PostTaskAndReply. | |
| 7 | |
| 8 #ifndef BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_ | |
| 9 #define BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_ | |
| 10 #pragma once | |
| 11 | |
| 12 #include "base/bind.h" | |
| 13 #include "base/location.h" | |
| 14 | |
| 15 namespace base { | |
| 16 | |
|
awong
2011/10/05 17:27:01
Put this in the base::internal namespace?
Jói
2011/10/06 14:20:31
Yes, I like that.
| |
| 17 // Inherit from this in a class that implements PostTask appropriately | |
| 18 // for sending to a destination thread. | |
| 19 // | |
| 20 // Note that 'reply' will always get posted back to your current | |
| 21 // MessageLoop. | |
| 22 // | |
| 23 // If you're looking for a concrete implementation of | |
| 24 // PostTaskAndReply, you probably want base::MessageLoopProxy, or you | |
| 25 // may want base::WorkerPool. | |
| 26 class PostTaskAndReplyImpl { | |
|
awong
2011/10/05 17:27:01
I think it'd be simpler to just loft the concrete
Jói
2011/10/06 14:20:31
That way there's duplication of code and the possi
awong
2011/10/06 19:53:52
I think I'm still in favor of removing this templa
| |
| 27 public: | |
| 28 // Implementation for MessageLoopProxy::PostTaskAndReply and | |
| 29 // WorkerPool::PostTaskAndReply. | |
| 30 bool PostTaskAndReply(const tracked_objects::Location& from_here, | |
| 31 const Closure& task, | |
| 32 const Closure& reply); | |
| 33 | |
| 34 protected: | |
| 35 virtual bool PostTask(const tracked_objects::Location& from_here, | |
| 36 const Closure& task) = 0; | |
| 37 }; | |
| 38 | |
| 39 } // namespace base | |
| 40 | |
| 41 #endif // BASE_THREADING_POST_TASK_AND_REPLY_IMPL_H_ | |
| OLD | NEW |