#ifndef CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_MULTITHREADED_WIN_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_MULTITHREADED_WIN_H_
#pragma once
#include <windows.h>
#include <queue>
#include "include/base/cef_lock.h"
#include "include/base/cef_platform_thread.h"
#include "tests/shared/browser/main_message_loop.h"
namespace client {
class MainMessageLoopMultithreadedWin : public MainMessageLoop {
public:
MainMessageLoopMultithreadedWin();
~MainMessageLoopMultithreadedWin();
int Run() override;
void Quit() override;
void PostTask(CefRefPtr<CefTask> task) override;
bool RunsTasksOnCurrentThread() const override;
void SetCurrentModelessDialog(HWND hWndDialog) override;
private:
static HWND CreateMessageWindow(HINSTANCE hInstance);
static LRESULT CALLBACK MessageWndProc(HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam);
void PostTaskInternal(CefRefPtr<CefTask> task);
base::PlatformThreadId thread_id_;
UINT task_message_id_;
HWND dialog_hwnd_;
base::Lock lock_;
HWND message_hwnd_;
std::queue<CefRefPtr<CefTask>> queued_tasks_;
DISALLOW_COPY_AND_ASSIGN(MainMessageLoopMultithreadedWin);
};
}
#endif