Skip to content

Commit

Permalink
Apply changes from original cefglue repo (OutSystems#85)
Browse files Browse the repository at this point in the history
* Apply changes from original cefglue repo

* Apply PR suggestions

* Apply PR suggestions
  • Loading branch information
cangosta authored Apr 28, 2023
1 parent 6adc68f commit 55bfefb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CefGlue.BrowserProcess/Handlers/RenderProcessHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ protected override void OnWebKitInitialized()

protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
{
using (message)

WithErrorHandling(() =>
{
using (CefObjectTracker.StartTracking())
{
_messageDispatcher.DispatchMessage(browser, frame, sourceProcess, message);
}
}, frame);

return base.OnProcessMessageReceived(browser, frame, sourceProcess, message);
}

Expand Down
1 change: 1 addition & 0 deletions CefGlue.Common/CommonCefClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame fr
{
try
{
using (message)
_messageDispatcher.DispatchMessage(browser, frame, sourceProcess, message);
return base.OnProcessMessageReceived(browser, frame, sourceProcess, message);
}
Expand Down
12 changes: 7 additions & 5 deletions CefGlue/Classes.Handlers/CefClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,20 @@ private int on_process_message_received(cef_client_t* self, cef_browser_t* brows

var m_browser = CefBrowser.FromNative(browser);
var m_frame = CefFrame.FromNative(frame);
using (var m_message = CefProcessMessage.FromNative(message))
{
var result = OnProcessMessageReceived(m_browser, m_frame, source_process, m_message);
return result ? 1 : 0;
}

// Client is responsible to call `Dispose()` on message when it no more needed.
var m_message = CefProcessMessage.FromNative(message);

var result = OnProcessMessageReceived(m_browser, m_frame, source_process, m_message);
return result ? 1 : 0;
}

/// <summary>
/// Called when a new message is received from a different process. Return
/// true if the message was handled or false otherwise. It is safe to keep a
/// reference to |message| outside of this callback.
/// </summary>
/// <remarks>Client code is responsible to call CefProcessMessage::Dispose() when it no more needed.</remarks>
protected virtual bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
{
return false;
Expand Down
12 changes: 7 additions & 5 deletions CefGlue/Classes.Handlers/CefRenderProcessHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,20 @@ private int on_process_message_received(cef_render_process_handler_t* self, cef_

var m_browser = CefBrowser.FromNative(browser);
var m_frame = CefFrame.FromNative(frame);
using (var m_message = CefProcessMessage.FromNative(message))
{
var result = OnProcessMessageReceived(m_browser, m_frame, source_process, m_message);
return result ? 1 : 0;
}

// Client is responsible to call `Dispose()` on message when it no more needed.
var m_message = CefProcessMessage.FromNative(message);

var result = OnProcessMessageReceived(m_browser, m_frame, source_process, m_message);
return result ? 1 : 0;
}

/// <summary>
/// Called when a new message is received from a different process. Return
/// true if the message was handled or false otherwise. It is safe to keep a
/// reference to |message| outside of this callback.
/// </summary>
/// <remarks>Client code is responsible to call CefProcessMessage::Dispose() when it no more needed.</remarks>
protected virtual bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
{
return false;
Expand Down

0 comments on commit 55bfefb

Please sign in to comment.