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

Side by Side Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc

Issue 7890046: Command to mark surface inactive, so gpu process can release resources. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: final rebase and added comments Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h ('k') | ui/gfx/gl/gl_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
8 8
9 #include "gpu/GLES2/gl2.h" 9 #include "gpu/GLES2/gl2.h"
10 #ifndef GL_GLEXT_PROTOTYPES 10 #ifndef GL_GLEXT_PROTOTYPES
11 #define GL_GLEXT_PROTOTYPES 1 11 #define GL_GLEXT_PROTOTYPES 1
12 #endif 12 #endif
13 #include "gpu/GLES2/gl2ext.h" 13 #include "gpu/GLES2/gl2ext.h"
14 14
15 #include <algorithm> 15 #include <algorithm>
16 #include <set> 16 #include <set>
17 17
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/lazy_instance.h" 19 #include "base/lazy_instance.h"
20 #include "base/string_tokenizer.h" 20 #include "base/string_tokenizer.h"
21 #include "base/command_line.h" 21 #include "base/command_line.h"
22 #include "base/debug/trace_event.h" 22 #include "base/debug/trace_event.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/metrics/histogram.h" 24 #include "base/metrics/histogram.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
27 #include "content/renderer/gpu/command_buffer_proxy.h"
27 #include "content/renderer/gpu/gpu_channel_host.h" 28 #include "content/renderer/gpu/gpu_channel_host.h"
28 #include "content/renderer/render_thread_impl.h" 29 #include "content/renderer/render_thread_impl.h"
29 #include "content/renderer/render_view_impl.h" 30 #include "content/renderer/render_view_impl.h"
30 #include "gpu/command_buffer/client/gles2_implementation.h" 31 #include "gpu/command_buffer/client/gles2_implementation.h"
31 #include "gpu/command_buffer/common/constants.h" 32 #include "gpu/command_buffer/common/constants.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
35 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" 36 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
36 37
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 cached_width_ = width; 294 cached_width_ = width;
294 cached_height_ = height; 295 cached_height_ = height;
295 296
296 gl_->ResizeCHROMIUM(width, height); 297 gl_->ResizeCHROMIUM(width, height);
297 298
298 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 299 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
299 scanline_.reset(new uint8[width * 4]); 300 scanline_.reset(new uint8[width * 4]);
300 #endif // FLIP_FRAMEBUFFER_VERTICALLY 301 #endif // FLIP_FRAMEBUFFER_VERTICALLY
301 } 302 }
302 303
304 void WebGraphicsContext3DCommandBufferImpl::setVisibility(bool visible) {
305 gl_->Flush();
306 context_->SetSurfaceVisible(visible);
307 }
308
303 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 309 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
304 void WebGraphicsContext3DCommandBufferImpl::FlipVertically( 310 void WebGraphicsContext3DCommandBufferImpl::FlipVertically(
305 uint8* framebuffer, 311 uint8* framebuffer,
306 unsigned int width, 312 unsigned int width,
307 unsigned int height) { 313 unsigned int height) {
308 uint8* scanline = scanline_.get(); 314 uint8* scanline = scanline_.get();
309 if (!scanline) 315 if (!scanline)
310 return; 316 return;
311 unsigned int row_bytes = width * 4; 317 unsigned int row_bytes = width * 4;
312 unsigned int count = height / 2; 318 unsigned int count = height / 2;
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 if (context_lost_callback_) { 1121 if (context_lost_callback_) {
1116 context_lost_callback_->onContextLost(); 1122 context_lost_callback_->onContextLost();
1117 } 1123 }
1118 RenderViewImpl* renderview = 1124 RenderViewImpl* renderview =
1119 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; 1125 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL;
1120 if (renderview) 1126 if (renderview)
1121 renderview->OnViewContextSwapBuffersAborted(); 1127 renderview->OnViewContextSwapBuffersAborted();
1122 } 1128 }
1123 1129
1124 #endif // defined(ENABLE_GPU) 1130 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h ('k') | ui/gfx/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698