Using CEF inside a Photoshop Plugin instead of basic HWND
Posted: Thu Feb 15, 2018 7:54 pm
Hello,
I have an issue about integrating CEF inside a Photoshop Plugin. (Note that I'm on Windows 7, using latest Spotify CEF build = cef_binary_3.3282.1733.g9091548_windows64).
So lets start from the beginning, Im using Photoshop CS6 SDK, Im building a Photoshop Plugin for CS and CC (Note that Adobe created their own CEF integration in Photoshop CC, but not for CS).
In the SDK, you have the following code :
Which is the code that the Plugin call when its about to render a UI, note that GetDLLInstance() is the function returning the instance of the Plugin inside Photoshop.exe.
So Im trying to replace the DialogBoxParam, by a call to a CEF, by using the following,
The windows seems to be generated with a title (cefsimple), but that it, nothing is render inside (Full white windows), despite the url is still pointing on http://www.google.com, I also tried to point on a local index.html in-case, but same thing.
And when looking to the console output (With log_severity = LOGSEVERITY_VERBOSE), I have the following errors :
After that, there are a tons more a message about "Histogram:" and tons of text, I didn't copy since its too long and maybe irrelevant, and the end of that log finish with :
Without verbosity, I just see the 3 followings line about CEF:
I achieve to disable gpu using the OnBeforeCommandLineProcessing. This only removes the line about "Failed to launch GPU process.", the Lost UI and Check failed persist.
I don't know what I'm doing wrong ? Is there anything about the GetDllInstant() that I provided to CefMainArgs ? is Photoshop.exe process blocking CEF for an unknown reason ?
I understand that Photoshop.exe might be connected to the GPU, so CEF multi-process could not connect to it, but that not important for me. So I would like to know, what could I do or test a settings to get something working ?
PS: when closing the windows, a lot of exceptions are thrown by photoshop and CEF, I don't really mind right now, because it might due to the current error anyway.
Thanks
I have an issue about integrating CEF inside a Photoshop Plugin. (Note that I'm on Windows 7, using latest Spotify CEF build = cef_binary_3.3282.1733.g9091548_windows64).
So lets start from the beginning, Im using Photoshop CS6 SDK, Im building a Photoshop Plugin for CS and CC (Note that Adobe created their own CEF integration in Photoshop CC, but not for CS).
In the SDK, you have the following code :
- Code: Select all
Boolean DoUI(void)
{
PlatformData* platform = (PlatformData*)(gFilterRecord->platformData);
INT_PTR result = DialogBoxParam(GetDLLInstance(),
(LPSTR)"DISSOLVEDIALOG",
(HWND)platform->hwnd,
(DLGPROC)DissolveProc,
NULL);
//used by the DissolveProc routine, don't let the error go further
*gResult = noErr;
return (result == kDOK);
}
Which is the code that the Plugin call when its about to render a UI, note that GetDLLInstance() is the function returning the instance of the Plugin inside Photoshop.exe.
So Im trying to replace the DialogBoxParam, by a call to a CEF, by using the following,
- Code: Select all
Boolean DoUI(void)
{
// Enable High-DPI support on Windows 7 or newer.
CefEnableHighDPISupport();
void* sandbox_info = NULL;
// Provide CEF with command-line arguments.
CefMainArgs main_args(GetDLLInstance());
// CEF applications have multiple sub-processes (render, plugin, GPU, etc)
// that share the same executable. This function checks the command-line and,
// if this is a sub-process, executes the appropriate logic.
int exit_code = CefExecuteProcess(main_args, NULL, sandbox_info);
if ( exit_code >= 0 )
{
// The sub-process has completed so return here.
return exit_code;
}
// Specify CEF global settings here.
CefSettings settings;
settings.log_severity = LOGSEVERITY_VERBOSE;
// SimpleApp implements application-level callbacks for the browser process.
// It will create the first browser instance in OnContextInitialized() after
// CEF has initialized.
CefRefPtr<SimpleApp> app(new SimpleApp);
// Initialize CEF.
CefInitialize(main_args, settings, app.get(), sandbox_info);
// Run the CEF message loop. This will block until CefQuitMessageLoop() is
// called.
CefRunMessageLoop();
// Shut down CEF.
CefShutdown();
return m_result;
}
The windows seems to be generated with a title (cefsimple), but that it, nothing is render inside (Full white windows), despite the url is still pointing on http://www.google.com, I also tried to point on a local index.html in-case, but same thing.
And when looking to the console output (With log_severity = LOGSEVERITY_VERBOSE), I have the following errors :
- Code: Select all
[0215/193116.650:VERBOSE1:node_controller.cc(172)] Initializing node 336CC32B5DD8104D.59E670AE16D6CAED
[0215/193116.700:VERBOSE1:pref_proxy_config_tracker_impl.cc(154)] 000000001993A5A0: set chrome proxy config service to 00000000199CEFD0
[0215/193116.703:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Aviator' log
[0215/193116.703:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Icarus' log
[0215/193116.703:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Pilot' log
[0215/193116.704:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Rocketeer' log
[0215/193116.704:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Google 'Skydiver' log
[0215/193116.704:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: DigiCert Log Server
[0215/193116.704:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: DigiCert Log Server 2
[0215/193116.705:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec log
[0215/193116.705:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec 'Vega' log
[0215/193116.705:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Symantec 'Sirius' log
[0215/193116.706:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: WoSign log
[0215/193116.706:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Venafi Gen2 CT log
[0215/193116.706:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: CNNIC CT log
[0215/193116.707:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: StartCom log
[0215/193116.707:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Comodo 'Sabre' CT log
[0215/193116.707:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Comodo 'Mammoth' CT log
[0215/193116.708:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Izenpe log
[0215/193116.708:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Venafi log
[0215/193116.708:VERBOSE1:multi_log_ct_verifier.cc(75)] Adding CT log: Certly.IO log
[0215/193116.709:VERBOSE1:network_connection.cc(30)] Updating NetworkConnection's Cached Data
[0215/193116.721:VERBOSE1:webrtc_internals.cc(109)] Could not get the download directory.
[0215/193116.723:VERBOSE1:node.cc(425)] Merging local ports A7442D2716584C92.377BC346C92224FA@336CC32B5DD8104D.59E670AE16D6CAED and FEAC31E0176631AF.7F704A013398132F@336CC32B5DD8104D.59E670AE16D6CAED
[0215/193116.740:VERBOSE1:file_util_win.cc(436)] CreateDirectory(GPUCache), directory already exists.
'Photoshop.exe' (Win32): Loaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'. Cannot find or open the PDB file.
'Photoshop.exe' (Win32): Unloaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'
[0215/193116.771:VERBOSE1:node.cc(435)] Observing lost connection from node 336CC32B5DD8104D.59E670AE16D6CAED to node 659EDC4E11620515.E73C896755BC5607
[0215/193116.772:VERBOSE1:browser_gpu_channel_host_factory.cc(147)] Failed to create channel on existing GPU process. Trying to restart GPU process.
'Photoshop.exe' (Win32): Loaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'. Cannot find or open the PDB file.
'Photoshop.exe' (Win32): Unloaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'
[0215/193116.843:VERBOSE1:node.cc(435)] Observing lost connection from node 336CC32B5DD8104D.59E670AE16D6CAED to node 43D1DA02D8B89775.34966F45C185AD46
[0215/193116.874:VERBOSE1:node.cc(435)] Observing lost connection from node 336CC32B5DD8104D.59E670AE16D6CAED to node 6639CC9A6EB0057C.91C5570B4AE0EF81
[0215/193116.875:VERBOSE1:browser_gpu_channel_host_factory.cc(147)] Failed to create channel on existing GPU process. Trying to restart GPU process.
'Photoshop.exe' (Win32): Loaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'. Cannot find or open the PDB file.
'Photoshop.exe' (Win32): Unloaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'
[0215/193116.973:VERBOSE1:node.cc(435)] Observing lost connection from node 336CC32B5DD8104D.59E670AE16D6CAED to node ADB9ECF33DB15621.E465F4BC6B17DAEE
[0215/193116.975:VERBOSE1:browser_gpu_channel_host_factory.cc(147)] Failed to create channel on existing GPU process. Trying to restart GPU process.
'Photoshop.exe' (Win32): Loaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'. Cannot find or open the PDB file.
'Photoshop.exe' (Win32): Unloaded 'C:\Program Files\Adobe\Adobe Photoshop CS4 (64 Bit)\Photoshop.exe'
[0215/193117.092:VERBOSE1:node.cc(435)] Observing lost connection from node 336CC32B5DD8104D.59E670AE16D6CAED to node 9D0092C04E20D31C.8C43A54970CBB588
[0215/193117.094:VERBOSE1:browser_gpu_channel_host_factory.cc(147)] Failed to create channel on existing GPU process. Trying to restart GPU process.
[0215/193117.099:ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process.
[0215/193117.101:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
[0215/193117.106:VERBOSE1:histogram.cc(401)] Histogram: Compositing.Browser.LayersUpdateTime.0 has bad minimum: 0
[0215/193118.443:VERBOSE1:histogram.cc(401)] Histogram: Compositing.Browser.LayersUpdateTime.0 has bad minimum: 0
The thread 0x9738 has exited with code 0 (0x0).
The thread 0x9424 has exited with code 0 (0x0).
The thread 0x91a0 has exited with code 0 (0x0).
The thread 0x9290 has exited with code 0 (0x0).
The thread 0x9008 has exited with code 0 (0x0).
The thread 0x712c has exited with code 0 (0x0).
The thread 0x9708 has exited with code 0 (0x0).
The thread 0x19bc has exited with code 0 (0x0).
The thread 0xc4 has exited with code 0 (0x0).
[0215/193119.890:VERBOSE1:media_stream_manager.cc(486)] ~MediaStreamManager
The thread 0x95dc has exited with code 0 (0x0).
The thread 0x8978 has exited with code 0 (0x0).
First-chance exception at 0x000007FEFD94A06D (KernelBase.dll) in Photoshop.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.
[0215/193119.896:VERBOSE1:statistics_recorder.cc(528)] Collections of all histograms
After that, there are a tons more a message about "Histogram:" and tons of text, I didn't copy since its too long and maybe irrelevant, and the end of that log finish with :
- Code: Select all
[0215/193120.900:FATAL:broker_services.cc(134)] Check failed: false.
Without verbosity, I just see the 3 followings line about CEF:
- Code: Select all
[0215/193117.099:ERROR:browser_gpu_channel_host_factory.cc(121)] Failed to launch GPU process.
[0215/193117.101:ERROR:gpu_process_transport_factory.cc(1019)] Lost UI shared context.
[0215/193120.900:FATAL:broker_services.cc(134)] Check failed: false.
I achieve to disable gpu using the OnBeforeCommandLineProcessing. This only removes the line about "Failed to launch GPU process.", the Lost UI and Check failed persist.
I don't know what I'm doing wrong ? Is there anything about the GetDllInstant() that I provided to CefMainArgs ? is Photoshop.exe process blocking CEF for an unknown reason ?
I understand that Photoshop.exe might be connected to the GPU, so CEF multi-process could not connect to it, but that not important for me. So I would like to know, what could I do or test a settings to get something working ?
PS: when closing the windows, a lot of exceptions are thrown by photoshop and CEF, I don't really mind right now, because it might due to the current error anyway.
Thanks