cef/libcef/common/task_runner_manager.h
Marshall Greenblatt 1174994211 Add initial chrome runtime support (see issue #2969)
Running `cefsimple --enable-chrome-runtime` will create and run a
Chrome browser window using the CEF app methods, and call
CefApp::OnContextInitialized as expected. CEF task methods also
work as expected in the main process. No browser-related methods or
callbacks are currently supported for the Chrome window, and the
application will exit when the last Chrome window closes.

The Chrome runtime requires resources.pak, chrome_100_percent.pak
and chrome_200_percent.pak files which were not previously built
with CEF. It shares the existing locales pak files which have been
updated to include additional Chrome-specific strings.

On Linux, the Chrome runtime requires GTK so use_gtk=true must be
specified via GN_DEFINES when building.

This change also refactors the CEF runtime, which can be tested in
the various supported modes by running:
$ cefclient
$ cefclient --multi-threaded-message-loop
$ cefclient --external-message-pump
2020-06-29 16:17:23 -04:00

38 lines
1.3 KiB
C++

// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_COMMON_TASK_RUNNER_MANAGER_H_
#define CEF_LIBCEF_COMMON_TASK_RUNNER_MANAGER_H_
#pragma once
#include "base/single_thread_task_runner.h"
// Exposes global sequenced task runners in the main and render processes.
// Prefer using base::ThreadPool for tasks that do not need to be globally
// sequenced and CefTaskRunner for retrieving named CefThreadId runners.
class CefTaskRunnerManager {
public:
// Returns the singleton instance that is scoped to CEF lifespan.
static CefTaskRunnerManager* Get();
// Available in the main process:
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetBackgroundTaskRunner() = 0;
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetUserVisibleTaskRunner() = 0;
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetUserBlockingTaskRunner() = 0;
// Available in the render process:
virtual scoped_refptr<base::SingleThreadTaskRunner> GetRenderTaskRunner() = 0;
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetWebWorkerTaskRunner() = 0;
protected:
CefTaskRunnerManager();
virtual ~CefTaskRunnerManager();
};
#endif // CEF_LIBCEF_COMMON_TASK_RUNNER_MANAGER_H_