• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 
5 #include "tests/shared/browser/main_message_loop.h"
6 
7 #include "include/cef_task.h"
8 #include "include/wrapper/cef_closure_task.h"
9 
10 namespace client {
11 
12 namespace {
13 
14 MainMessageLoop* g_main_message_loop = nullptr;
15 
16 }  // namespace
17 
MainMessageLoop()18 MainMessageLoop::MainMessageLoop() {
19   DCHECK(!g_main_message_loop);
20   g_main_message_loop = this;
21 }
22 
~MainMessageLoop()23 MainMessageLoop::~MainMessageLoop() {
24   g_main_message_loop = nullptr;
25 }
26 
27 // static
Get()28 MainMessageLoop* MainMessageLoop::Get() {
29   DCHECK(g_main_message_loop);
30   return g_main_message_loop;
31 }
32 
PostClosure(base::OnceClosure closure)33 void MainMessageLoop::PostClosure(base::OnceClosure closure) {
34   PostTask(CefCreateClosureTask(std::move(closure)));
35 }
36 
PostClosure(const base::RepeatingClosure & closure)37 void MainMessageLoop::PostClosure(const base::RepeatingClosure& closure) {
38   PostTask(CefCreateClosureTask(closure));
39 }
40 
41 }  // namespace client
42