From d0bd4816cb0149e16dbc621444594ffb2a106fd2 Mon Sep 17 00:00:00 2001 From: gellert Date: Wed, 27 Jul 2016 18:02:54 +0200 Subject: [PATCH] adds tracing calls and osx fix --- atom/browser/osr_window.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/atom/browser/osr_window.cc b/atom/browser/osr_window.cc index 4233d224e49f..492514c26616 100644 --- a/atom/browser/osr_window.cc +++ b/atom/browser/osr_window.cc @@ -316,6 +316,7 @@ class CefCopyFrameGenerator { // int x = static_cast(pixels[i]); // std::cout << std::hex << x << std::dec << std::endl; // } + TRACE_EVENT0("electron", "OffScreenWindow::OnPaint"); if (view_->paintCallback) { view_->paintCallback->Run(damage_rect, bitmap.width(), bitmap.height(), pixels); @@ -420,11 +421,13 @@ OffScreenWindow::OffScreenWindow( root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); - //CreatePlatformWidget(); - compositor_widget_ = native_window_->GetAcceleratedWidget(); +#if defined(OS_MACOSX) + CreatePlatformWidget(); +#endif #if !defined(OS_MACOSX) // On OS X the ui::Compositor is created/owned by the platform view. + compositor_widget_ = native_window_->GetAcceleratedWidget(); compositor_.reset( new ui::Compositor(content::GetContextFactory(), base::ThreadTaskRunnerHandle::Get())); @@ -434,9 +437,6 @@ OffScreenWindow::OffScreenWindow( compositor_->SetRootLayer(root_layer_.get()); ResizeRootLayer(); - - std::unique_ptr sbp = content::HostSharedBitmapManager::current()->AllocateSharedBitmap(gfx::Size(800, 600)); - printf("shared bitmap: %p\n", sbp.get()); } void OffScreenWindow::ResizeRootLayer() { @@ -551,9 +551,13 @@ gfx::Vector2dF OffScreenWindow::GetLastScrollOffset() const { gfx::NativeView OffScreenWindow::GetNativeView() const { // std::cout << "GetNativeView" << std::endl; +#if defined(OS_MACOSX) + return gfx::NativeView(); +#elif auto widget = views::Widget::GetWidgetForNativeWindow( native_window_->GetNativeWindow()); return widget->GetNativeView(); +#endif } gfx::NativeViewAccessible OffScreenWindow::GetNativeViewAccessible() { @@ -642,9 +646,10 @@ bool OffScreenWindow::GetScreenColorProfile(std::vector*) { void OffScreenWindow::OnSwapCompositorFrame( uint32_t output_surface_id, std::unique_ptr frame) { - base::Time now = base::Time::Now(); + // base::Time now = base::Time::Now(); // std::cout << "OnSwapCompositorFrame " << (now - last_time_).InMilliseconds() << " ms" << std::endl; - last_time_ = now; + // last_time_ = now; + TRACE_EVENT0("electron", "OffScreenWindow::OnSwapCompositorFrame"); // std::cout << output_surface_id << std::endl;