Skip to content

Commit

Permalink
Fix external message pump implementation (#246).
Browse files Browse the repository at this point in the history
Update CEF to branch 3359 on Mac.
  • Loading branch information
cztomczak committed Aug 7, 2018
1 parent 1a3ca6b commit c760eb5
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ examples/webrtc_event_logs/
unittests/GPUCache/
unittests/blob_storage/
unittests/webrtc_event_logs/
.DS_Store
18 changes: 11 additions & 7 deletions src/cefpython.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,11 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
# External message pump
if GetAppSetting("external_message_pump")\
and not g_external_message_pump.get():
g_external_message_pump.reset(
MainMessageLoopExternalPump.Create().get())
Debug("Create external message pump")
# Using .reset() here to assign new instance was causing
# MainMessageLoopExternalPump destructor to be called. Strange.
g_external_message_pump.Assign(
MainMessageLoopExternalPump.Create())

Debug("CefInitialize()")
cdef cpp_bool ret
Expand Down Expand Up @@ -930,15 +933,16 @@ def Shutdown():
# Debug("Free g_shared_request_context")
# g_shared_request_context.Assign(NULL)

Debug("CefShutdown()")
with nogil:
CefShutdown()

# Release external message pump, as in cefclient after Shutdown
# Release external message pump before CefShutdown, so that
# message pump timer is killed.
if g_external_message_pump.get():
Debug("Reset external message pump")
# Reset will set it to NULL
g_external_message_pump.reset()

Debug("CefShutdown()")
with nogil:
CefShutdown()

def SetOsModalLoop(py_bool modalLoop):
cdef cpp_bool cefModalLoop = bool(modalLoop)
Expand Down
2 changes: 2 additions & 0 deletions src/extern/cef/cef_scoped_ptr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ cdef extern from "include/base/cef_scoped_ptr.h":
void reset(T* p)
# noinspection PyUnresolvedReferences
T* get()
# noinspection PyUnresolvedReferences
scoped_ptr[T]& Assign "operator="(scoped_ptr[T] p)
2 changes: 1 addition & 1 deletion src/subprocess/Makefile-libcefpythonapp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ifeq ($(UNAME_S), Linux)
SRC_MORE = print_handler_gtk.cpp ../client_handler/x11.cpp \
main_message_loop/main_message_loop_external_pump_linux.cpp
else ifeq ($(UNAME_S), Darwin)
SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm
SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm
endif

SRC = cefpython_app.cpp v8function_handler.cpp v8utils.cpp \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const int32 kTimerDelayPlaceholder = INT_MAX;
// DoWork().
const int64 kMaxTimerDelay = 1000 / 30; // 30fps

MainMessageLoopExternalPump* g_external_message_pump = NULL;
::MainMessageLoopExternalPump* g_external_message_pump = NULL;

} // namespace

Expand All @@ -43,6 +43,8 @@ MainMessageLoopExternalPump* MainMessageLoopExternalPump::Get() {

void MainMessageLoopExternalPump::OnScheduleWork(int64 delay_ms) {
REQUIRE_MAIN_THREAD();
// LOG(INFO) << "MainMessageLoopExternalPump::OnScheduleWork";
// LOG(INFO) << delay_ms << " ms";

if (delay_ms == kTimerDelayPlaceholder && IsTimerPending()) {
// Don't set the maximum timer requested from DoWork() if a timer event is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ - (void)timerTimeout:(id)obj {
}

int MainMessageLoopExternalPumpMac::Run() {
LOG(INFO) << "MainMessageLoopExternalPumpMac::Run";
// Run the message loop.
[NSApp run];

Expand Down
24 changes: 12 additions & 12 deletions src/version/cef_version_mac.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -35,16 +35,16 @@
#ifndef CEF_INCLUDE_CEF_VERSION_H_
#define CEF_INCLUDE_CEF_VERSION_H_

#define CEF_VERSION "3.2987.1601.gf035232"
#define CEF_VERSION "3.3359.1774.gd49d25f"
#define CEF_VERSION_MAJOR 3
#define CEF_COMMIT_NUMBER 1601
#define CEF_COMMIT_HASH "f035232c082f837d2b85bd7821a93a54fc742775"
#define COPYRIGHT_YEAR 2017
#define CEF_COMMIT_NUMBER 1774
#define CEF_COMMIT_HASH "d49d25f881b68f418e243e12801cbbb7caebb563"
#define COPYRIGHT_YEAR 2018

#define CHROME_VERSION_MAJOR 57
#define CHROME_VERSION_MAJOR 66
#define CHROME_VERSION_MINOR 0
#define CHROME_VERSION_BUILD 2987
#define CHROME_VERSION_PATCH 133
#define CHROME_VERSION_BUILD 3359
#define CHROME_VERSION_PATCH 181

#define DO_MAKE_STRING(p) #p
#define MAKE_STRING(p) DO_MAKE_STRING(p)
Expand All @@ -63,13 +63,13 @@ extern "C" {
// universal hash value will change if any platform is affected whereas the
// platform hash values will change only if that particular platform is
// affected.
#define CEF_API_HASH_UNIVERSAL "b0a24e3e202f3d8b72f2fbc1ebc5864f96ec16ae"
#define CEF_API_HASH_UNIVERSAL "84263345b0b1143139aba560e5e5ed16fb6a9628"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "1c6a27f840ac87c8c971350c907edbe2c5fa0387"
#define CEF_API_HASH_PLATFORM "cf092ef692a2ff18b0fc732b58bde9b8b8655fcc"
#elif defined(OS_MACOSX)
#define CEF_API_HASH_PLATFORM "1567db600ee83cc2a59bb8c17ca416d11a7c9b8a"
#define CEF_API_HASH_PLATFORM "34f636bde2f02cb43c10061f384af4fc51c26e1f"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "1f9f9e15bf7cf13de2557ddd411dfc9f694503b0"
#define CEF_API_HASH_PLATFORM "6b57a640612f8d459042917ad2568b1526a70af4"
#endif

// Returns CEF version information for the libcef library. The |entry|
Expand Down

0 comments on commit c760eb5

Please sign in to comment.