Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: services/ui/ws/platform_display.cc

Issue 2497303002: Fix ws::Display initialization order. (Closed)
Patch Set: Fix use after move in test. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/platform_display.cc
diff --git a/services/ui/ws/platform_display.cc b/services/ui/ws/platform_display.cc
index f27fd784c8da424b8354869f17d909baab587f1c..72bb054c6d720c246b0b81860fe0e953a0ac5770 100644
--- a/services/ui/ws/platform_display.cc
+++ b/services/ui/ws/platform_display.cc
@@ -4,6 +4,8 @@
#include "services/ui/ws/platform_display.h"
+#include <utility>
+
#include "base/numerics/safe_conversions.h"
#include "build/build_config.h"
#include "cc/ipc/quads.mojom.h"
@@ -44,12 +46,12 @@ namespace ws {
PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr;
// static
-PlatformDisplay* PlatformDisplay::Create(
+std::unique_ptr<PlatformDisplay> PlatformDisplay::Create(
const PlatformDisplayInitParams& init_params) {
if (factory_)
return factory_->CreatePlatformDisplay();
- return new DefaultPlatformDisplay(init_params);
+ return base::MakeUnique<DefaultPlatformDisplay>(init_params);
}
DefaultPlatformDisplay::DefaultPlatformDisplay(
@@ -257,6 +259,10 @@ void DefaultPlatformDisplay::OnLostCapture() {
void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget,
float device_scale_factor) {
+ // This will get called after Init() is called, either synchronously as part
+ // of the Init() callstack or async after Init() has returned, depending on
+ // the platform.
+ delegate_->OnAcceleratedWidgetAvailable();
frame_generator_->OnAcceleratedWidgetAvailable(widget);
}
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698