adds tracing calls and osx fix

This commit is contained in:
gellert 2016-07-27 18:02:54 +02:00
parent a39bb35744
commit d0bd4816cb

View file

@ -316,6 +316,7 @@ class CefCopyFrameGenerator {
// int x = static_cast<int>(pixels[i]); // int x = static_cast<int>(pixels[i]);
// std::cout << std::hex << x << std::dec << std::endl; // std::cout << std::hex << x << std::dec << std::endl;
// } // }
TRACE_EVENT0("electron", "OffScreenWindow::OnPaint");
if (view_->paintCallback) { if (view_->paintCallback) {
view_->paintCallback->Run(damage_rect, bitmap.width(), bitmap.height(), view_->paintCallback->Run(damage_rect, bitmap.width(), bitmap.height(),
pixels); pixels);
@ -420,11 +421,13 @@ OffScreenWindow::OffScreenWindow(
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
//CreatePlatformWidget(); #if defined(OS_MACOSX)
compositor_widget_ = native_window_->GetAcceleratedWidget(); CreatePlatformWidget();
#endif
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
// On OS X the ui::Compositor is created/owned by the platform view. // On OS X the ui::Compositor is created/owned by the platform view.
compositor_widget_ = native_window_->GetAcceleratedWidget();
compositor_.reset( compositor_.reset(
new ui::Compositor(content::GetContextFactory(), new ui::Compositor(content::GetContextFactory(),
base::ThreadTaskRunnerHandle::Get())); base::ThreadTaskRunnerHandle::Get()));
@ -434,9 +437,6 @@ OffScreenWindow::OffScreenWindow(
compositor_->SetRootLayer(root_layer_.get()); compositor_->SetRootLayer(root_layer_.get());
ResizeRootLayer(); ResizeRootLayer();
std::unique_ptr<cc::SharedBitmap> sbp = content::HostSharedBitmapManager::current()->AllocateSharedBitmap(gfx::Size(800, 600));
printf("shared bitmap: %p\n", sbp.get());
} }
void OffScreenWindow::ResizeRootLayer() { void OffScreenWindow::ResizeRootLayer() {
@ -551,9 +551,13 @@ gfx::Vector2dF OffScreenWindow::GetLastScrollOffset() const {
gfx::NativeView OffScreenWindow::GetNativeView() const { gfx::NativeView OffScreenWindow::GetNativeView() const {
// std::cout << "GetNativeView" << std::endl; // std::cout << "GetNativeView" << std::endl;
#if defined(OS_MACOSX)
return gfx::NativeView();
#elif
auto widget = views::Widget::GetWidgetForNativeWindow( auto widget = views::Widget::GetWidgetForNativeWindow(
native_window_->GetNativeWindow()); native_window_->GetNativeWindow());
return widget->GetNativeView(); return widget->GetNativeView();
#endif
} }
gfx::NativeViewAccessible OffScreenWindow::GetNativeViewAccessible() { gfx::NativeViewAccessible OffScreenWindow::GetNativeViewAccessible() {
@ -642,9 +646,10 @@ bool OffScreenWindow::GetScreenColorProfile(std::vector<char>*) {
void OffScreenWindow::OnSwapCompositorFrame( void OffScreenWindow::OnSwapCompositorFrame(
uint32_t output_surface_id, uint32_t output_surface_id,
std::unique_ptr<cc::CompositorFrame> frame) { std::unique_ptr<cc::CompositorFrame> frame) {
base::Time now = base::Time::Now(); // base::Time now = base::Time::Now();
// std::cout << "OnSwapCompositorFrame " << (now - last_time_).InMilliseconds() << " ms" << std::endl; // 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; // std::cout << output_surface_id << std::endl;