add_contentgpuclient_precreatemessageloop_callback.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Milan Burda <[email protected]>
  3. Date: Thu, 11 Apr 2019 14:49:20 +0200
  4. Subject: add_contentgpuclient_precreatemessageloop_callback.patch
  5. This adds a ContentGpuClient::PreCreateMessageLoop() callback.
  6. Invoke in GpuMain after SetErrorMode, before starting the message loop.
  7. Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set.
  8. This should be upstreamed.
  9. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
  10. index 59ab3b746782c71f7d9401c13a7c866e6e7a823d..f95842da98d3a1d853633b53c745be9c394b25d5 100644
  11. --- a/content/gpu/gpu_main.cc
  12. +++ b/content/gpu/gpu_main.cc
  13. @@ -258,6 +258,10 @@ int GpuMain(MainFunctionParams parameters) {
  14. // to the GpuProcessHost once the GpuServiceImpl has started.
  15. viz::GpuServiceImpl::InstallPreInitializeLogHandler();
  16. + auto* client = GetContentClient()->gpu();
  17. + if (client)
  18. + client->PreCreateMessageLoop();
  19. +
  20. // We are experiencing what appear to be memory-stomp issues in the GPU
  21. // process. These issues seem to be impacting the task executor and listeners
  22. // registered to it. Create the task executor on the heap to guard against
  23. @@ -368,7 +372,6 @@ int GpuMain(MainFunctionParams parameters) {
  24. #endif
  25. const bool dead_on_arrival = !init_success;
  26. - auto* client = GetContentClient()->gpu();
  27. if (client) {
  28. client->PostSandboxInitialized();
  29. }
  30. diff --git a/content/public/gpu/content_gpu_client.h b/content/public/gpu/content_gpu_client.h
  31. index c89b010e7ac78e2a7246ee54fe302cd6b9299710..46fd522fb2ac2793a3a073a4f833a4425dcee941 100644
  32. --- a/content/public/gpu/content_gpu_client.h
  33. +++ b/content/public/gpu/content_gpu_client.h
  34. @@ -32,6 +32,10 @@ class CONTENT_EXPORT ContentGpuClient {
  35. public:
  36. virtual ~ContentGpuClient() {}
  37. + // Allows the embedder to perform platform-specific initialization before
  38. + // creating the message loop.
  39. + virtual void PreCreateMessageLoop() {}
  40. +
  41. // Called during initialization once the GpuService has been initialized.
  42. virtual void GpuServiceInitialized() {}