Skip to content

Commit 56aa89b

Browse files
linesightclaude
andcommitted
Fix CEF 146 API changes in Linux message loop and print handler
- main_message_loop_external_pump_linux.cpp: OVERRIDE->override, int64->int64_t, scoped_ptr->std::unique_ptr, add #include <memory> - print_handler_gtk.cpp: add cef_callback.h include before cef_bind.h so OnceCallback is fully defined when BindOnce is used Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8be3209 commit 56aa89b

2 files changed

Lines changed: 21 additions & 19 deletions

File tree

src/subprocess/main_message_loop/main_message_loop_external_pump_linux.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <errno.h>
1010
#include <fcntl.h>
1111
#include <math.h>
12+
#include <memory>
1213

1314
#include <glib.h>
1415

@@ -55,11 +56,11 @@ class MainMessageLoopExternalPumpLinux : public MainMessageLoopExternalPump {
5556
~MainMessageLoopExternalPumpLinux();
5657

5758
// MainMessageLoopStd methods:
58-
void Quit() OVERRIDE;
59-
int Run() OVERRIDE;
59+
void Quit() override;
60+
int Run() override;
6061

6162
// MainMessageLoopExternalPump methods:
62-
void OnScheduleMessagePumpWork(int64 delay_ms) OVERRIDE;
63+
void OnScheduleMessagePumpWork(int64_t delay_ms) override;
6364

6465
// Internal methods used for processing the pump callbacks. They are public
6566
// for simplicity but should not be used directly. HandlePrepare is called
@@ -73,9 +74,9 @@ class MainMessageLoopExternalPumpLinux : public MainMessageLoopExternalPump {
7374

7475
protected:
7576
// MainMessageLoopExternalPump methods:
76-
void SetTimer(int64 delay_ms) OVERRIDE;
77-
void KillTimer() OVERRIDE;
78-
bool IsTimerPending() OVERRIDE;
77+
void SetTimer(int64_t delay_ms) override;
78+
void KillTimer() override;
79+
bool IsTimerPending() override;
7980

8081
private:
8182
// Used to flag that the Run() invocation should return ASAP.
@@ -98,8 +99,8 @@ class MainMessageLoopExternalPumpLinux : public MainMessageLoopExternalPump {
9899
int wakeup_pipe_read_;
99100
int wakeup_pipe_write_;
100101

101-
// Use a scoped_ptr to avoid needing the definition of GPollFD in the header.
102-
scoped_ptr<GPollFD> wakeup_gpollfd_;
102+
// Use a std::unique_ptr to avoid needing the definition of GPollFD in the header.
103+
std::unique_ptr<GPollFD> wakeup_gpollfd_;
103104
};
104105

105106
// Return a timeout suitable for the glib loop, -1 to block forever,
@@ -226,12 +227,12 @@ int MainMessageLoopExternalPumpLinux::Run() {
226227
}
227228

228229
void MainMessageLoopExternalPumpLinux::OnScheduleMessagePumpWork(
229-
int64 delay_ms) {
230+
int64_t delay_ms) {
230231
// This can be called on any thread, so we don't want to touch any state
231232
// variables as we would then need locks all over. This ensures that if we
232233
// are sleeping in a poll that we will wake up.
233-
if (HANDLE_EINTR(write(wakeup_pipe_write_, &delay_ms, sizeof(int64))) !=
234-
sizeof(int64)) {
234+
if (HANDLE_EINTR(write(wakeup_pipe_write_, &delay_ms, sizeof(int64_t))) !=
235+
sizeof(int64_t)) {
235236
NOTREACHED() << "Could not write to the UI message loop wakeup pipe!";
236237
}
237238
}
@@ -250,15 +251,15 @@ bool MainMessageLoopExternalPumpLinux::HandleCheck() {
250251
// The glib poll will tell us whether there was data, so this read shouldn't
251252
// block.
252253
if (wakeup_gpollfd_->revents & G_IO_IN) {
253-
int64 delay_ms[2];
254+
int64_t delay_ms[2];
254255
const size_t num_bytes =
255-
HANDLE_EINTR(read(wakeup_pipe_read_, delay_ms, sizeof(int64) * 2));
256-
if (num_bytes < sizeof(int64)) {
256+
HANDLE_EINTR(read(wakeup_pipe_read_, delay_ms, sizeof(int64_t) * 2));
257+
if (num_bytes < sizeof(int64_t)) {
257258
NOTREACHED() << "Error reading from the wakeup pipe.";
258259
}
259-
if (num_bytes == sizeof(int64))
260+
if (num_bytes == sizeof(int64_t))
260261
OnScheduleWork(delay_ms[0]);
261-
if (num_bytes == sizeof(int64) * 2)
262+
if (num_bytes == sizeof(int64_t) * 2)
262263
OnScheduleWork(delay_ms[1]);
263264
}
264265

@@ -275,7 +276,7 @@ void MainMessageLoopExternalPumpLinux::HandleDispatch() {
275276
OnTimerTimeout();
276277
}
277278

278-
void MainMessageLoopExternalPumpLinux::SetTimer(int64 delay_ms) {
279+
void MainMessageLoopExternalPumpLinux::SetTimer(int64_t delay_ms) {
279280
DCHECK_GT(delay_ms, 0);
280281

281282
CefTime now;
@@ -296,8 +297,8 @@ bool MainMessageLoopExternalPumpLinux::IsTimerPending() {
296297
} // namespace
297298

298299
// static
299-
scoped_ptr<MainMessageLoopExternalPump>
300+
std::unique_ptr<MainMessageLoopExternalPump>
300301
MainMessageLoopExternalPump::Create() {
301-
return scoped_ptr<MainMessageLoopExternalPump>(
302+
return std::unique_ptr<MainMessageLoopExternalPump>(
302303
new MainMessageLoopExternalPumpLinux());
303304
}

src/subprocess/print_handler_gtk.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <gtk/gtk.h>
1414
#include <gtk/gtkunixprint.h>
1515

16+
#include "include/base/cef_callback.h"
1617
#include "include/base/cef_bind.h"
1718
#include "include/base/cef_logging.h"
1819
#include "include/base/cef_macros.h"

0 commit comments

Comments
 (0)