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

Side by Side Diff: android_webview/browser/in_process_renderer/in_process_view_renderer.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dedup and refactor code Created 7 years, 7 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 | « no previous file | cc/output/output_surface_client.h » ('j') | cc/output/output_surface_client.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "android_webview/browser/in_process_renderer/in_process_view_renderer.h " 5 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h "
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "android_webview/public/browser/draw_gl.h" 9 #include "android_webview/public/browser/draw_gl.h"
10 #include "android_webview/public/browser/draw_sw.h" 10 #include "android_webview/public/browser/draw_sw.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 web_contents_->SetUserData(kUserDataKey, new UserData(this)); 175 web_contents_->SetUserData(kUserDataKey, new UserData(this));
176 } 176 }
177 177
178 void InProcessViewRenderer::WebContentsGone() { 178 void InProcessViewRenderer::WebContentsGone() {
179 web_contents_ = NULL; 179 web_contents_ = NULL;
180 } 180 }
181 181
182 bool InProcessViewRenderer::PrepareDrawGL(int x, int y) { 182 bool InProcessViewRenderer::PrepareDrawGL(int x, int y) {
183 // No harm in updating |hw_rendering_scroll_| even if we return false. 183 // No harm in updating |hw_rendering_scroll_| even if we return false.
184 hw_rendering_scroll_ = gfx::Point(x, y); 184 hw_rendering_scroll_ = gfx::Point(x, y);
185 return attached_to_window_ && compositor_ && compositor_->IsHwReady() && 185 return attached_to_window_ && compositor_ && !hardware_failed_;
186 !hardware_failed_;
187 } 186 }
188 187
189 void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { 188 void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) {
190 DCHECK(view_visible_); 189 DCHECK(view_visible_);
191 190
192 // We need to watch if the current Android context has changed and enforce 191 // We need to watch if the current Android context has changed and enforce
193 // a clean-up in the compositor. 192 // a clean-up in the compositor.
194 EGLContext current_context = eglGetCurrentContext(); 193 EGLContext current_context = eglGetCurrentContext();
195 if (!current_context) { 194 if (!current_context) {
196 LOG(WARNING) << "No current context attached. Skipping composite."; 195 LOG(WARNING) << "No current context attached. Skipping composite.";
197 return; 196 return;
198 } 197 }
199 198
200 if (attached_to_window_ && compositor_ && !hardware_initialized_) { 199 if (attached_to_window_ && compositor_ && !hardware_initialized_) {
201 // TODO(boliu): Actually initialize the compositor GL path. 200 hardware_failed_ = !compositor_->InitializeHwDraw();
202 hardware_initialized_ = true; 201 hardware_initialized_ = true;
joth 2013/05/21 02:08:00 lets rename these two memebers: hardware_initializ
203 egl_context_at_init_ = current_context; 202 egl_context_at_init_ = current_context;
203
204 if (hardware_failed_)
205 return;
204 } 206 }
205 207
joth 2013/05/21 02:08:00 guess we could DCHECK(!hardware_failed_) here
206 if (draw_info->mode == AwDrawGLInfo::kModeProcess) 208 if (draw_info->mode == AwDrawGLInfo::kModeProcess)
207 return; 209 return;
208 210
209 if (egl_context_at_init_ != current_context) { 211 if (egl_context_at_init_ != current_context) {
210 // TODO(boliu): Handle context lost 212 // TODO(boliu): Handle context lost
211 } 213 }
212 214
213 // TODO(boliu): Make sure this is not called before compositor is initialized 215 // TODO(boliu): Make sure this is not called before compositor is initialized
214 // and GL is ready. Then make this a DCHECK. 216 // and GL is ready. Then make this a DCHECK.
215 if (!compositor_) 217 if (!compositor_)
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page 424 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page
423 // scale here. Determine what if any needs bringing over to this class. 425 // scale here. Determine what if any needs bringing over to this class.
424 return CompositeSW(canvas); 426 return CompositeSW(canvas);
425 } 427 }
426 428
427 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) { 429 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) {
428 return compositor_ && compositor_->DemandDrawSw(canvas); 430 return compositor_ && compositor_->DemandDrawSw(canvas);
429 } 431 }
430 432
431 } // namespace android_webview 433 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | cc/output/output_surface_client.h » ('j') | cc/output/output_surface_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698