[M67 Dev][EWK] Classify EWK APIs by public, internal, or product
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / public / ewk_dispatcher.cc
1 // Copyright 2013 Samsung Electronics. 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 #include "ewk_dispatcher_internal.h"
6 #include <assert.h>
7
8 // // TODO: remove dependency to chromium internal
9 #include <base/bind.h>
10 #include <base/location.h>
11
12 #include "base/threading/thread_task_runner_handle.h"
13
14 using namespace base;
15
16 static scoped_refptr<base::SingleThreadTaskRunner> g_task_runner;
17
18 void ewk_dispatcher_touch()
19 {
20   g_task_runner = base::ThreadTaskRunnerHandle::Get();
21 }
22
23 void ewk_dispatcher_dispatch(ewk_dispatch_callback cb, void *user_data, unsigned delay)
24 {
25   if (delay) {
26     g_task_runner->PostDelayedTask(FROM_HERE,
27                                    Bind(cb, user_data),
28                                    TimeDelta::FromMilliseconds(delay));
29   } else {
30     g_task_runner->PostTask(FROM_HERE,
31                             Bind(cb, user_data));
32   }
33 }
34
35