blob: 604148af1e2be1f9aa765557c954ec44a983658a [file] [log] [blame]
Ningyuan Wangdb805e22015-11-20 14:08:47 -08001//
2// Copyright (C) 2015 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#ifndef DHCP_CLIENT_MESSAGE_LOOP_EVENT_DISPATCHER_H_
18#define DHCP_CLIENT_MESSAGE_LOOP_EVENT_DISPATCHER_H_
19
20#include <base/callback.h>
21
22#include <dhcp_client/event_dispatcher_interface.h>
23
24namespace dhcp_client {
25
26// Class for dispatching tasks to current message loop.
27class MessageLoopEventDispatcher : public EventDispatcherInterface {
28 public:
29 MessageLoopEventDispatcher();
30 ~MessageLoopEventDispatcher() override;
31
32 // These are thin wrappers around calls of the same name in
33 // <base/message_loop_proxy.h>
34 bool PostTask(const base::Closure& task) override;
35 bool PostDelayedTask(const base::Closure& task,
36 int64_t delay_ms) override;
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(MessageLoopEventDispatcher);
40};
41
42} // namespace dhcp_client
43
44#endif // DHCP_CLIENT_MESSAGE_LOOP_EVENT_DISPATCHER_H_