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

Side by Side Diff: content/browser/compositor/offscreen_browser_compositor_output_surface.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/compositor/offscreen_browser_compositor_output_surface .h" 5 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); 128 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_);
129 } 129 }
130 } 130 }
131 131
132 GLenum 132 GLenum
133 OffscreenBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { 133 OffscreenBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
134 return GLCopyTextureInternalFormat(kFboTextureFormat); 134 return GLCopyTextureInternalFormat(kFboTextureFormat);
135 } 135 }
136 136
137 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( 137 void OffscreenBrowserCompositorOutputSurface::SwapBuffers(
138 cc::CompositorFrame* frame) { 138 cc::CompositorFrame frame) {
139 if (reflector_) { 139 if (reflector_) {
140 if (frame->gl_frame_data->sub_buffer_rect == 140 if (frame.gl_frame_data->sub_buffer_rect ==
141 gfx::Rect(frame->gl_frame_data->size)) 141 gfx::Rect(frame.gl_frame_data->size))
142 reflector_->OnSourceSwapBuffers(); 142 reflector_->OnSourceSwapBuffers();
143 else 143 else
144 reflector_->OnSourcePostSubBuffer(frame->gl_frame_data->sub_buffer_rect); 144 reflector_->OnSourcePostSubBuffer(frame.gl_frame_data->sub_buffer_rect);
145 } 145 }
146 146
147 client_->DidSwapBuffers(); 147 client_->DidSwapBuffers();
148 148
149 // TODO(oshima): sync with the reflector's SwapBuffersComplete 149 // TODO(oshima): sync with the reflector's SwapBuffersComplete
150 // (crbug.com/520567). 150 // (crbug.com/520567).
151 // The original implementation had a flickering issue (crbug.com/515332). 151 // The original implementation had a flickering issue (crbug.com/515332).
152 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 152 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
153 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 153 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
154 gl->ShallowFlushCHROMIUM(); 154 gl->ShallowFlushCHROMIUM();
155 155
156 gpu::SyncToken sync_token; 156 gpu::SyncToken sync_token;
157 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 157 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
158 context_provider_->ContextSupport()->SignalSyncToken( 158 context_provider_->ContextSupport()->SignalSyncToken(
159 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete, 159 sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete,
160 weak_ptr_factory_.GetWeakPtr())); 160 weak_ptr_factory_.GetWeakPtr()));
161 } 161 }
162 162
163 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() { 163 void OffscreenBrowserCompositorOutputSurface::OnReflectorChanged() {
164 if (reflector_) 164 if (reflector_)
165 EnsureBackbuffer(); 165 EnsureBackbuffer();
166 } 166 }
167 167
168 base::Closure 168 base::Closure
169 OffscreenBrowserCompositorOutputSurface::CreateCompositionStartedCallback() { 169 OffscreenBrowserCompositorOutputSurface::CreateCompositionStartedCallback() {
170 return base::Closure(); 170 return base::Closure();
171 } 171 }
172 172
173 } // namespace content 173 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698