Skip to content

Commit c760eb5

Browse files
committed
Fix external message pump implementation (cztomczak#246).
Update CEF to branch 3359 on Mac.
1 parent 1a3ca6b commit c760eb5

File tree

7 files changed

+31
-21
lines changed

7 files changed

+31
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ examples/webrtc_event_logs/
1515
unittests/GPUCache/
1616
unittests/blob_storage/
1717
unittests/webrtc_event_logs/
18+
.DS_Store

src/cefpython.pyx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,11 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
622622
# External message pump
623623
if GetAppSetting("external_message_pump")\
624624
and not g_external_message_pump.get():
625-
g_external_message_pump.reset(
626-
MainMessageLoopExternalPump.Create().get())
625+
Debug("Create external message pump")
626+
# Using .reset() here to assign new instance was causing
627+
# MainMessageLoopExternalPump destructor to be called. Strange.
628+
g_external_message_pump.Assign(
629+
MainMessageLoopExternalPump.Create())
627630

628631
Debug("CefInitialize()")
629632
cdef cpp_bool ret
@@ -930,15 +933,16 @@ def Shutdown():
930933
# Debug("Free g_shared_request_context")
931934
# g_shared_request_context.Assign(NULL)
932935

933-
Debug("CefShutdown()")
934-
with nogil:
935-
CefShutdown()
936-
937-
# Release external message pump, as in cefclient after Shutdown
936+
# Release external message pump before CefShutdown, so that
937+
# message pump timer is killed.
938938
if g_external_message_pump.get():
939+
Debug("Reset external message pump")
939940
# Reset will set it to NULL
940941
g_external_message_pump.reset()
941942

943+
Debug("CefShutdown()")
944+
with nogil:
945+
CefShutdown()
942946

943947
def SetOsModalLoop(py_bool modalLoop):
944948
cdef cpp_bool cefModalLoop = bool(modalLoop)

src/extern/cef/cef_scoped_ptr.pxd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ cdef extern from "include/base/cef_scoped_ptr.h":
1313
void reset(T* p)
1414
# noinspection PyUnresolvedReferences
1515
T* get()
16+
# noinspection PyUnresolvedReferences
17+
scoped_ptr[T]& Assign "operator="(scoped_ptr[T] p)

src/subprocess/Makefile-libcefpythonapp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ifeq ($(UNAME_S), Linux)
1515
SRC_MORE = print_handler_gtk.cpp ../client_handler/x11.cpp \
1616
main_message_loop/main_message_loop_external_pump_linux.cpp
1717
else ifeq ($(UNAME_S), Darwin)
18-
SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm
18+
SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm
1919
endif
2020

2121
SRC = cefpython_app.cpp v8function_handler.cpp v8utils.cpp \

src/subprocess/main_message_loop/main_message_loop_external_pump.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const int32 kTimerDelayPlaceholder = INT_MAX;
2222
// DoWork().
2323
const int64 kMaxTimerDelay = 1000 / 30; // 30fps
2424

25-
MainMessageLoopExternalPump* g_external_message_pump = NULL;
25+
::MainMessageLoopExternalPump* g_external_message_pump = NULL;
2626

2727
} // namespace
2828

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

4444
void MainMessageLoopExternalPump::OnScheduleWork(int64 delay_ms) {
4545
REQUIRE_MAIN_THREAD();
46+
// LOG(INFO) << "MainMessageLoopExternalPump::OnScheduleWork";
47+
// LOG(INFO) << delay_ms << " ms";
4648

4749
if (delay_ms == kTimerDelayPlaceholder && IsTimerPending()) {
4850
// Don't set the maximum timer requested from DoWork() if a timer event is

src/subprocess/main_message_loop/main_message_loop_external_pump_mac.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ - (void)timerTimeout:(id)obj {
9292
}
9393

9494
int MainMessageLoopExternalPumpMac::Run() {
95+
LOG(INFO) << "MainMessageLoopExternalPumpMac::Run";
9596
// Run the message loop.
9697
[NSApp run];
9798

src/version/cef_version_mac.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
1+
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions are
@@ -35,16 +35,16 @@
3535
#ifndef CEF_INCLUDE_CEF_VERSION_H_
3636
#define CEF_INCLUDE_CEF_VERSION_H_
3737

38-
#define CEF_VERSION "3.2987.1601.gf035232"
38+
#define CEF_VERSION "3.3359.1774.gd49d25f"
3939
#define CEF_VERSION_MAJOR 3
40-
#define CEF_COMMIT_NUMBER 1601
41-
#define CEF_COMMIT_HASH "f035232c082f837d2b85bd7821a93a54fc742775"
42-
#define COPYRIGHT_YEAR 2017
40+
#define CEF_COMMIT_NUMBER 1774
41+
#define CEF_COMMIT_HASH "d49d25f881b68f418e243e12801cbbb7caebb563"
42+
#define COPYRIGHT_YEAR 2018
4343

44-
#define CHROME_VERSION_MAJOR 57
44+
#define CHROME_VERSION_MAJOR 66
4545
#define CHROME_VERSION_MINOR 0
46-
#define CHROME_VERSION_BUILD 2987
47-
#define CHROME_VERSION_PATCH 133
46+
#define CHROME_VERSION_BUILD 3359
47+
#define CHROME_VERSION_PATCH 181
4848

4949
#define DO_MAKE_STRING(p) #p
5050
#define MAKE_STRING(p) DO_MAKE_STRING(p)
@@ -63,13 +63,13 @@ extern "C" {
6363
// universal hash value will change if any platform is affected whereas the
6464
// platform hash values will change only if that particular platform is
6565
// affected.
66-
#define CEF_API_HASH_UNIVERSAL "b0a24e3e202f3d8b72f2fbc1ebc5864f96ec16ae"
66+
#define CEF_API_HASH_UNIVERSAL "84263345b0b1143139aba560e5e5ed16fb6a9628"
6767
#if defined(OS_WIN)
68-
#define CEF_API_HASH_PLATFORM "1c6a27f840ac87c8c971350c907edbe2c5fa0387"
68+
#define CEF_API_HASH_PLATFORM "cf092ef692a2ff18b0fc732b58bde9b8b8655fcc"
6969
#elif defined(OS_MACOSX)
70-
#define CEF_API_HASH_PLATFORM "1567db600ee83cc2a59bb8c17ca416d11a7c9b8a"
70+
#define CEF_API_HASH_PLATFORM "34f636bde2f02cb43c10061f384af4fc51c26e1f"
7171
#elif defined(OS_LINUX)
72-
#define CEF_API_HASH_PLATFORM "1f9f9e15bf7cf13de2557ddd411dfc9f694503b0"
72+
#define CEF_API_HASH_PLATFORM "6b57a640612f8d459042917ad2568b1526a70af4"
7373
#endif
7474

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

0 commit comments

Comments
 (0)