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

Side by Side Diff: ui/compositor/test/in_process_context_factory.cc

Issue 2699173002: cc: Make OutputSurfaceFrame::sub_buffer_rect optional (Closed)
Patch Set: Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void Reshape(const gfx::Size& size, 72 void Reshape(const gfx::Size& size,
73 float device_scale_factor, 73 float device_scale_factor,
74 const gfx::ColorSpace& color_space, 74 const gfx::ColorSpace& color_space,
75 bool has_alpha, 75 bool has_alpha,
76 bool use_stencil) override { 76 bool use_stencil) override {
77 context_provider()->ContextGL()->ResizeCHROMIUM( 77 context_provider()->ContextGL()->ResizeCHROMIUM(
78 size.width(), size.height(), device_scale_factor, has_alpha); 78 size.width(), size.height(), device_scale_factor, has_alpha);
79 } 79 }
80 void SwapBuffers(cc::OutputSurfaceFrame frame) override { 80 void SwapBuffers(cc::OutputSurfaceFrame frame) override {
81 DCHECK(context_provider_.get()); 81 DCHECK(context_provider_.get());
82 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) { 82 if (frame.sub_buffer_rect) {
83 context_provider_->ContextSupport()->PartialSwapBuffers(
84 *frame.sub_buffer_rect);
85 } else {
83 context_provider_->ContextSupport()->Swap(); 86 context_provider_->ContextSupport()->Swap();
84 } else {
85 context_provider_->ContextSupport()->PartialSwapBuffers(
86 frame.sub_buffer_rect);
87 } 87 }
88 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 88 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
89 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); 89 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
90 gl->ShallowFlushCHROMIUM(); 90 gl->ShallowFlushCHROMIUM();
91 91
92 gpu::SyncToken sync_token; 92 gpu::SyncToken sync_token;
93 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 93 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
94 94
95 context_provider_->ContextSupport()->SignalSyncToken( 95 context_provider_->ContextSupport()->SignalSyncToken(
96 sync_token, base::Bind(&DirectOutputSurface::OnSwapBuffersComplete, 96 sync_token, base::Bind(&DirectOutputSurface::OnSwapBuffersComplete,
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 data->surface_handle = tracker->AddSurfaceForNativeWidget(widget); 336 data->surface_handle = tracker->AddSurfaceForNativeWidget(widget);
337 #endif 337 #endif
338 } 338 }
339 339
340 PerCompositorData* return_ptr = data.get(); 340 PerCompositorData* return_ptr = data.get();
341 per_compositor_data_[compositor] = std::move(data); 341 per_compositor_data_[compositor] = std::move(data);
342 return return_ptr; 342 return return_ptr;
343 } 343 }
344 344
345 } // namespace ui 345 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698