OLD | NEW |
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/common/content_switches.h" | 26 #include "content/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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 cached_width_ = width; | 262 cached_width_ = width; |
262 cached_height_ = height; | 263 cached_height_ = height; |
263 | 264 |
264 gl_->ResizeCHROMIUM(width, height); | 265 gl_->ResizeCHROMIUM(width, height); |
265 | 266 |
266 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 267 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
267 scanline_.reset(new uint8[width * 4]); | 268 scanline_.reset(new uint8[width * 4]); |
268 #endif // FLIP_FRAMEBUFFER_VERTICALLY | 269 #endif // FLIP_FRAMEBUFFER_VERTICALLY |
269 } | 270 } |
270 | 271 |
| 272 void WebGraphicsContext3DCommandBufferImpl::setVisibility(bool visible) { |
| 273 gl_->Flush(); |
| 274 context_->SetSurfaceVisible(visible); |
| 275 } |
| 276 |
271 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 277 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
272 void WebGraphicsContext3DCommandBufferImpl::FlipVertically( | 278 void WebGraphicsContext3DCommandBufferImpl::FlipVertically( |
273 uint8* framebuffer, | 279 uint8* framebuffer, |
274 unsigned int width, | 280 unsigned int width, |
275 unsigned int height) { | 281 unsigned int height) { |
276 uint8* scanline = scanline_.get(); | 282 uint8* scanline = scanline_.get(); |
277 if (!scanline) | 283 if (!scanline) |
278 return; | 284 return; |
279 unsigned int row_bytes = width * 4; | 285 unsigned int row_bytes = width * 4; |
280 unsigned int count = height / 2; | 286 unsigned int count = height / 2; |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 if (context_lost_callback_) { | 1089 if (context_lost_callback_) { |
1084 context_lost_callback_->onContextLost(); | 1090 context_lost_callback_->onContextLost(); |
1085 } | 1091 } |
1086 RenderViewImpl* renderview = | 1092 RenderViewImpl* renderview = |
1087 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; | 1093 web_view_ ? RenderViewImpl::FromWebView(web_view_) : NULL; |
1088 if (renderview) | 1094 if (renderview) |
1089 renderview->OnViewContextSwapBuffersAborted(); | 1095 renderview->OnViewContextSwapBuffersAborted(); |
1090 } | 1096 } |
1091 | 1097 |
1092 #endif // defined(ENABLE_GPU) | 1098 #endif // defined(ENABLE_GPU) |
OLD | NEW |