| OLD | NEW |
| 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 "android_webview/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
| 6 | 6 |
| 7 #include "android_webview/common/aw_switches.h" |
| 7 #include "android_webview/browser/browser_view_renderer_client.h" | 8 #include "android_webview/browser/browser_view_renderer_client.h" |
| 8 #include "android_webview/browser/shared_renderer_state.h" | 9 #include "android_webview/browser/shared_renderer_state.h" |
| 9 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
| 10 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 11 #include "base/auto_reset.h" | 12 #include "base/auto_reset.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "cc/output/compositor_frame.h" |
| 18 #include "content/public/browser/android/synchronous_compositor.h" | 20 #include "content/public/browser/android/synchronous_compositor.h" |
| 19 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 22 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 23 #include "third_party/skia/include/core/SkCanvas.h" | 25 #include "third_party/skia/include/core/SkCanvas.h" |
| 24 #include "third_party/skia/include/core/SkPicture.h" | 26 #include "third_party/skia/include/core/SkPicture.h" |
| 25 #include "third_party/skia/include/core/SkPictureRecorder.h" | 27 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 26 #include "ui/gfx/vector2d_conversions.h" | 28 #include "ui/gfx/vector2d_conversions.h" |
| 27 | 29 |
| 28 using base::android::AttachCurrentThread; | 30 using base::android::AttachCurrentThread; |
| 29 using base::android::JavaRef; | 31 using base::android::JavaRef; |
| 30 using base::android::ScopedJavaLocalRef; | 32 using base::android::ScopedJavaLocalRef; |
| 31 using content::BrowserThread; | 33 using content::BrowserThread; |
| 32 using content::SynchronousCompositorMemoryPolicy; | 34 using content::SynchronousCompositorMemoryPolicy; |
| 33 | 35 |
| 34 namespace android_webview { | 36 namespace android_webview { |
| 35 | 37 |
| 36 namespace { | 38 namespace { |
| 37 | 39 |
| 38 const int64 kFallbackTickTimeoutInMilliseconds = 20; | 40 const int64 kFallbackTickTimeoutInMilliseconds = 500; |
| 39 | 41 |
| 40 // Used to calculate memory allocation. Determined experimentally. | 42 // Used to calculate memory allocation. Determined experimentally. |
| 41 const size_t kMemoryMultiplier = 10; | 43 const size_t kMemoryMultiplier = 10; |
| 42 const size_t kBytesPerPixel = 4; | 44 const size_t kBytesPerPixel = 4; |
| 43 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; | 45 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; |
| 44 | 46 |
| 45 // Used to calculate tile allocation. Determined experimentally. | 47 // Used to calculate tile allocation. Determined experimentally. |
| 46 const size_t kTileMultiplier = 12; | 48 const size_t kTileMultiplier = 12; |
| 47 const size_t kTileAllocationStep = 20; | 49 const size_t kTileAllocationStep = 20; |
| 48 // This will be set by static function CalculateTileMemoryPolicy() during init. | 50 // This will be set by static function CalculateTileMemoryPolicy() during init. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 window_visible_(false), | 132 window_visible_(false), |
| 131 attached_to_window_(false), | 133 attached_to_window_(false), |
| 132 dip_scale_(0.0), | 134 dip_scale_(0.0), |
| 133 page_scale_factor_(1.0), | 135 page_scale_factor_(1.0), |
| 134 on_new_picture_enable_(false), | 136 on_new_picture_enable_(false), |
| 135 clear_view_(false), | 137 clear_view_(false), |
| 136 compositor_needs_continuous_invalidate_(false), | 138 compositor_needs_continuous_invalidate_(false), |
| 137 block_invalidates_(false), | 139 block_invalidates_(false), |
| 138 width_(0), | 140 width_(0), |
| 139 height_(0), | 141 height_(0), |
| 142 current_frame_id_(0u), |
| 140 num_tiles_(0u), | 143 num_tiles_(0u), |
| 141 num_bytes_(0u) { | 144 num_bytes_(0u), |
| 145 hardware_enabled_(false) { |
| 142 CHECK(web_contents_); | 146 CHECK(web_contents_); |
| 143 content::SynchronousCompositor::SetClientForWebContents(web_contents_, this); | 147 content::SynchronousCompositor::SetClientForWebContents(web_contents_, this); |
| 144 | 148 |
| 145 // Currently the logic in this class relies on |has_compositor_| remaining | 149 // Currently the logic in this class relies on |has_compositor_| remaining |
| 146 // false until the DidInitializeCompositor() call, hence it is not set here. | 150 // false until the DidInitializeCompositor() call, hence it is not set here. |
| 147 } | 151 } |
| 148 | 152 |
| 149 BrowserViewRenderer::~BrowserViewRenderer() { | 153 BrowserViewRenderer::~BrowserViewRenderer() { |
| 150 content::SynchronousCompositor::SetClientForWebContents(web_contents_, NULL); | 154 content::SynchronousCompositor::SetClientForWebContents(web_contents_, NULL); |
| 151 // OnDetachedFromWindow should be called before the destructor, so the memory | 155 // OnDetachedFromWindow should be called before the destructor, so the memory |
| (...skipping 29 matching lines...) Expand all Loading... |
| 181 | 185 |
| 182 TRACE_EVENT0("android_webview", "BrowserViewRenderer::TrimMemory"); | 186 TRACE_EVENT0("android_webview", "BrowserViewRenderer::TrimMemory"); |
| 183 | 187 |
| 184 RequestMemoryPolicy(zero_policy); | 188 RequestMemoryPolicy(zero_policy); |
| 185 EnforceMemoryPolicyImmediately(zero_policy); | 189 EnforceMemoryPolicyImmediately(zero_policy); |
| 186 } | 190 } |
| 187 | 191 |
| 188 SynchronousCompositorMemoryPolicy | 192 SynchronousCompositorMemoryPolicy |
| 189 BrowserViewRenderer::CalculateDesiredMemoryPolicy() { | 193 BrowserViewRenderer::CalculateDesiredMemoryPolicy() { |
| 190 SynchronousCompositorMemoryPolicy policy; | 194 SynchronousCompositorMemoryPolicy policy; |
| 191 size_t width = draw_gl_input_.global_visible_rect.width(); | 195 size_t width = global_visible_rect_.width(); |
| 192 size_t height = draw_gl_input_.global_visible_rect.height(); | 196 size_t height = global_visible_rect_.height(); |
| 193 policy.bytes_limit = kMemoryMultiplier * kBytesPerPixel * width * height; | 197 policy.bytes_limit = kMemoryMultiplier * kBytesPerPixel * width * height; |
| 194 // Round up to a multiple of kMemoryAllocationStep. | 198 // Round up to a multiple of kMemoryAllocationStep. |
| 195 policy.bytes_limit = | 199 policy.bytes_limit = |
| 196 (policy.bytes_limit / kMemoryAllocationStep + 1) * kMemoryAllocationStep; | 200 (policy.bytes_limit / kMemoryAllocationStep + 1) * kMemoryAllocationStep; |
| 197 | 201 |
| 198 size_t tiles = width * height * kTileMultiplier / g_tile_area; | 202 size_t tiles = width * height * kTileMultiplier / g_tile_area; |
| 199 // Round up to a multiple of kTileAllocationStep. The minimum number of tiles | 203 // Round up to a multiple of kTileAllocationStep. The minimum number of tiles |
| 200 // is also kTileAllocationStep. | 204 // is also kTileAllocationStep. |
| 201 tiles = (tiles / kTileAllocationStep + 1) * kTileAllocationStep; | 205 tiles = (tiles / kTileAllocationStep + 1) * kTileAllocationStep; |
| 202 policy.num_resources_limit = tiles; | 206 policy.num_resources_limit = tiles; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 244 |
| 241 size_t BrowserViewRenderer::GetNumTiles() const { | 245 size_t BrowserViewRenderer::GetNumTiles() const { |
| 242 return shared_renderer_state_->GetMemoryPolicy().num_resources_limit; | 246 return shared_renderer_state_->GetMemoryPolicy().num_resources_limit; |
| 243 } | 247 } |
| 244 | 248 |
| 245 bool BrowserViewRenderer::OnDraw(jobject java_canvas, | 249 bool BrowserViewRenderer::OnDraw(jobject java_canvas, |
| 246 bool is_hardware_canvas, | 250 bool is_hardware_canvas, |
| 247 const gfx::Vector2d& scroll, | 251 const gfx::Vector2d& scroll, |
| 248 const gfx::Rect& global_visible_rect, | 252 const gfx::Rect& global_visible_rect, |
| 249 const gfx::Rect& clip) { | 253 const gfx::Rect& clip) { |
| 250 draw_gl_input_.frame_id++; | 254 scroll_offset_ = scroll; |
| 251 draw_gl_input_.scroll_offset = scroll; | 255 global_visible_rect_ = global_visible_rect; |
| 252 draw_gl_input_.global_visible_rect = global_visible_rect; | 256 |
| 253 draw_gl_input_.width = width_; | |
| 254 draw_gl_input_.height = height_; | |
| 255 if (clear_view_) | 257 if (clear_view_) |
| 256 return false; | 258 return false; |
| 259 |
| 257 if (is_hardware_canvas && attached_to_window_) { | 260 if (is_hardware_canvas && attached_to_window_) { |
| 258 shared_renderer_state_->SetDrawGLInput(draw_gl_input_); | 261 if (switches::UbercompEnabled()) { |
| 259 | 262 return OnDrawHardware(java_canvas); |
| 260 SynchronousCompositorMemoryPolicy old_policy = | 263 } else { |
| 261 shared_renderer_state_->GetMemoryPolicy(); | 264 return OnDrawHardwareLegacy(java_canvas); |
| 262 SynchronousCompositorMemoryPolicy new_policy = | 265 } |
| 263 CalculateDesiredMemoryPolicy(); | |
| 264 RequestMemoryPolicy(new_policy); | |
| 265 // We should be performing a hardware draw here. If we don't have the | |
| 266 // compositor yet or if RequestDrawGL fails, it means we failed this draw | |
| 267 // and thus return false here to clear to background color for this draw. | |
| 268 bool did_draw_gl = | |
| 269 has_compositor_ && client_->RequestDrawGL(java_canvas, false); | |
| 270 if (did_draw_gl) | |
| 271 GlobalTileManager::GetInstance()->DidUse(tile_manager_key_); | |
| 272 else | |
| 273 RequestMemoryPolicy(old_policy); | |
| 274 | |
| 275 return did_draw_gl; | |
| 276 } | 266 } |
| 277 // Perform a software draw | 267 // Perform a software draw |
| 278 return DrawSWInternal(java_canvas, clip); | 268 return DrawSWInternal(java_canvas, clip); |
| 279 } | 269 } |
| 280 | 270 |
| 281 void BrowserViewRenderer::DidDrawGL(const DrawGLResult& result) { | 271 bool BrowserViewRenderer::OnDrawHardwareLegacy(jobject java_canvas) { |
| 282 DidComposite(!result.clip_contains_visible_rect); | 272 scoped_ptr<DrawGLInput> draw_gl_input(new DrawGLInput); |
| 273 draw_gl_input->frame_id = ++current_frame_id_; |
| 274 draw_gl_input->scroll_offset = scroll_offset_; |
| 275 draw_gl_input->global_visible_rect = global_visible_rect_; |
| 276 draw_gl_input->width = width_; |
| 277 draw_gl_input->height = height_; |
| 278 |
| 279 SynchronousCompositorMemoryPolicy old_policy = |
| 280 shared_renderer_state_->GetMemoryPolicy(); |
| 281 SynchronousCompositorMemoryPolicy new_policy = |
| 282 CalculateDesiredMemoryPolicy(); |
| 283 RequestMemoryPolicy(new_policy); |
| 284 // We should be performing a hardware draw here. If we don't have the |
| 285 // compositor yet or if RequestDrawGL fails, it means we failed this draw |
| 286 // and thus return false here to clear to background color for this draw. |
| 287 bool did_draw_gl = |
| 288 has_compositor_ && client_->RequestDrawGL(java_canvas, false); |
| 289 if (did_draw_gl) { |
| 290 GlobalTileManager::GetInstance()->DidUse(tile_manager_key_); |
| 291 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); |
| 292 } else { |
| 293 RequestMemoryPolicy(old_policy); |
| 294 } |
| 295 |
| 296 return did_draw_gl; |
| 297 } |
| 298 |
| 299 void BrowserViewRenderer::DidDrawGL(scoped_ptr<DrawGLResult> result) { |
| 300 DidComposite(!result->clip_contains_visible_rect); |
| 301 } |
| 302 |
| 303 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { |
| 304 if (!has_compositor_) |
| 305 return false; |
| 306 |
| 307 scoped_ptr<DrawGLInput> draw_gl_input(new DrawGLInput); |
| 308 draw_gl_input->frame_id = ++current_frame_id_; |
| 309 draw_gl_input->scroll_offset = scroll_offset_; |
| 310 draw_gl_input->global_visible_rect = global_visible_rect_; |
| 311 draw_gl_input->width = width_; |
| 312 draw_gl_input->height = height_; |
| 313 |
| 314 DCHECK(attached_to_window_); // TODO(boliu): Can this fail? |
| 315 if (!hardware_enabled_ && attached_to_window_) { |
| 316 hardware_enabled_ = |
| 317 shared_renderer_state_->GetCompositor()->InitializeHwDraw(NULL); |
| 318 } |
| 319 if (!hardware_enabled_) |
| 320 return false; |
| 321 |
| 322 SynchronousCompositorMemoryPolicy new_policy = CalculateDesiredMemoryPolicy(); |
| 323 RequestMemoryPolicy(new_policy); |
| 324 shared_renderer_state_->GetCompositor()->SetMemoryPolicy( |
| 325 shared_renderer_state_->GetMemoryPolicy()); |
| 326 |
| 327 ReturnResources(); |
| 328 |
| 329 gfx::Transform transform; |
| 330 gfx::Rect viewport(width_, height_); |
| 331 gfx::Rect clip = viewport; // Should really be global_visible_rect_. |
| 332 bool drew_delegated = |
| 333 shared_renderer_state_->GetCompositor()->DemandDrawDelegated( |
| 334 transform, viewport, clip, &draw_gl_input->frame); |
| 335 if (!drew_delegated) |
| 336 return false; |
| 337 |
| 338 GlobalTileManager::GetInstance()->DidUse(tile_manager_key_); |
| 339 scoped_ptr<DrawGLInput> old_input = |
| 340 shared_renderer_state_->SetDrawGLInput(draw_gl_input.Pass()); |
| 341 if (old_input.get()) { |
| 342 shared_renderer_state_->ReturnResources( |
| 343 old_input->frame.delegated_frame_data->resource_list); |
| 344 } |
| 345 |
| 346 DidComposite(false); |
| 347 bool did_request = client_->RequestDrawGL(java_canvas, false); |
| 348 if (did_request) |
| 349 return true; |
| 350 |
| 351 ReturnResources(); |
| 352 return false; |
| 353 } |
| 354 |
| 355 void BrowserViewRenderer::DidDrawDelegated(scoped_ptr<DrawGLResult> result) { |
| 356 if (!ui_task_runner_->BelongsToCurrentThread()) { |
| 357 // TODO(boliu): This could be lost if invalidate in between. Need a queue fo
r this. |
| 358 ui_task_runner_->PostTask(FROM_HERE, |
| 359 base::Bind(&BrowserViewRenderer::DidDrawDelegated, |
| 360 ui_thread_weak_ptr_, |
| 361 base::Passed(&result))); |
| 362 return; |
| 363 } |
| 364 ReturnResources(); |
| 365 } |
| 366 |
| 367 void BrowserViewRenderer::ReturnResources() { |
| 368 cc::CompositorFrameAck frame_ack; |
| 369 shared_renderer_state_->SwapReturnedResources(&frame_ack.resources); |
| 370 if (!frame_ack.resources.empty()) { |
| 371 shared_renderer_state_->GetCompositor()->ReturnResources(&frame_ack); |
| 372 } |
| 283 } | 373 } |
| 284 | 374 |
| 285 bool BrowserViewRenderer::DrawSWInternal(jobject java_canvas, | 375 bool BrowserViewRenderer::DrawSWInternal(jobject java_canvas, |
| 286 const gfx::Rect& clip) { | 376 const gfx::Rect& clip) { |
| 287 if (clip.IsEmpty()) { | 377 if (clip.IsEmpty()) { |
| 288 TRACE_EVENT_INSTANT0( | 378 TRACE_EVENT_INSTANT0( |
| 289 "android_webview", "EarlyOut_EmptyClip", TRACE_EVENT_SCOPE_THREAD); | 379 "android_webview", "EarlyOut_EmptyClip", TRACE_EVENT_SCOPE_THREAD); |
| 290 return true; | 380 return true; |
| 291 } | 381 } |
| 292 | 382 |
| 293 if (!has_compositor_) { | 383 if (!has_compositor_) { |
| 294 TRACE_EVENT_INSTANT0( | 384 TRACE_EVENT_INSTANT0( |
| 295 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); | 385 "android_webview", "EarlyOut_NoCompositor", TRACE_EVENT_SCOPE_THREAD); |
| 296 return false; | 386 return false; |
| 297 } | 387 } |
| 298 | 388 |
| 299 return BrowserViewRendererJavaHelper::GetInstance() | 389 return BrowserViewRendererJavaHelper::GetInstance() |
| 300 ->RenderViaAuxilaryBitmapIfNeeded( | 390 ->RenderViaAuxilaryBitmapIfNeeded( |
| 301 java_canvas, | 391 java_canvas, |
| 302 draw_gl_input_.scroll_offset, | 392 scroll_offset_, |
| 303 clip, | 393 clip, |
| 304 base::Bind(&BrowserViewRenderer::CompositeSW, | 394 base::Bind(&BrowserViewRenderer::CompositeSW, |
| 305 base::Unretained(this))); | 395 base::Unretained(this))); |
| 306 } | 396 } |
| 307 | 397 |
| 308 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, | 398 skia::RefPtr<SkPicture> BrowserViewRenderer::CapturePicture(int width, |
| 309 int height) { | 399 int height) { |
| 310 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); | 400 TRACE_EVENT0("android_webview", "BrowserViewRenderer::CapturePicture"); |
| 311 | 401 |
| 312 // Return empty Picture objects for empty SkPictures. | 402 // Return empty Picture objects for empty SkPictures. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 height); | 482 height); |
| 393 attached_to_window_ = true; | 483 attached_to_window_ = true; |
| 394 width_ = width; | 484 width_ = width; |
| 395 height_ = height; | 485 height_ = height; |
| 396 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); | 486 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); |
| 397 } | 487 } |
| 398 | 488 |
| 399 void BrowserViewRenderer::OnDetachedFromWindow() { | 489 void BrowserViewRenderer::OnDetachedFromWindow() { |
| 400 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDetachedFromWindow"); | 490 TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnDetachedFromWindow"); |
| 401 attached_to_window_ = false; | 491 attached_to_window_ = false; |
| 492 if (hardware_enabled_) { |
| 493 // Input should have been passed into HardwareRenderer. |
| 494 scoped_ptr<DrawGLInput> input = shared_renderer_state_->PassDrawGLInput(); |
| 495 if (input.get()) { |
| 496 shared_renderer_state_->ReturnResources( |
| 497 input->frame.delegated_frame_data->resource_list); |
| 498 } |
| 499 ReturnResources(); |
| 500 DCHECK(shared_renderer_state_->ReturnedResourcesEmpty()); |
| 501 |
| 502 shared_renderer_state_->GetCompositor()->ReleaseHwDraw(); |
| 503 hardware_enabled_ = false; |
| 504 } |
| 402 SynchronousCompositorMemoryPolicy zero_policy; | 505 SynchronousCompositorMemoryPolicy zero_policy; |
| 403 RequestMemoryPolicy(zero_policy); | 506 RequestMemoryPolicy(zero_policy); |
| 404 GlobalTileManager::GetInstance()->Remove(tile_manager_key_); | 507 GlobalTileManager::GetInstance()->Remove(tile_manager_key_); |
| 405 // The hardware resources are released in the destructor of hardware renderer, | 508 // The hardware resources are released in the destructor of hardware renderer, |
| 406 // so we don't need to do it here. | 509 // so we don't need to do it here. |
| 407 // See AwContents::ReleaseHardwareDrawOnRenderThread(JNIEnv*, jobject). | 510 // See AwContents::ReleaseHardwareDrawOnRenderThread(JNIEnv*, jobject). |
| 408 } | 511 } |
| 409 | 512 |
| 410 bool BrowserViewRenderer::IsAttachedToWindow() const { | 513 bool BrowserViewRenderer::IsAttachedToWindow() const { |
| 411 return attached_to_window_; | 514 return attached_to_window_; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 DCHECK(has_compositor_); | 836 DCHECK(has_compositor_); |
| 734 SkBitmap bitmap; | 837 SkBitmap bitmap; |
| 735 bitmap.allocN32Pixels(1, 1); | 838 bitmap.allocN32Pixels(1, 1); |
| 736 bitmap.eraseColor(0); | 839 bitmap.eraseColor(0); |
| 737 SkCanvas canvas(bitmap); | 840 SkCanvas canvas(bitmap); |
| 738 CompositeSW(&canvas); | 841 CompositeSW(&canvas); |
| 739 } | 842 } |
| 740 | 843 |
| 741 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { | 844 bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) { |
| 742 DCHECK(has_compositor_); | 845 DCHECK(has_compositor_); |
| 846 cc::CompositorFrame frame; |
| 743 bool result = shared_renderer_state_->GetCompositor()-> | 847 bool result = shared_renderer_state_->GetCompositor()-> |
| 744 DemandDrawSw(canvas); | 848 DemandDrawSw(canvas, &frame); |
| 745 DidComposite(false); | 849 DidComposite(false); |
| 746 return result; | 850 return result; |
| 747 } | 851 } |
| 748 | 852 |
| 749 void BrowserViewRenderer::DidComposite(bool force_invalidate) { | 853 void BrowserViewRenderer::DidComposite(bool force_invalidate) { |
| 750 { | 854 { |
| 751 base::AutoLock lock(render_thread_lock_); | 855 base::AutoLock lock(render_thread_lock_); |
| 752 block_invalidates_ = false; | 856 block_invalidates_ = false; |
| 753 } | 857 } |
| 754 | 858 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 773 base::StringAppendF(&str, "dip_scale: %f ", dip_scale_); | 877 base::StringAppendF(&str, "dip_scale: %f ", dip_scale_); |
| 774 base::StringAppendF(&str, "page_scale_factor: %f ", page_scale_factor_); | 878 base::StringAppendF(&str, "page_scale_factor: %f ", page_scale_factor_); |
| 775 base::StringAppendF(&str, | 879 base::StringAppendF(&str, |
| 776 "compositor_needs_continuous_invalidate: %d ", | 880 "compositor_needs_continuous_invalidate: %d ", |
| 777 compositor_needs_continuous_invalidate_); | 881 compositor_needs_continuous_invalidate_); |
| 778 base::StringAppendF(&str, "block_invalidates: %d ", block_invalidates_); | 882 base::StringAppendF(&str, "block_invalidates: %d ", block_invalidates_); |
| 779 base::StringAppendF(&str, "view width height: [%d %d] ", width_, height_); | 883 base::StringAppendF(&str, "view width height: [%d %d] ", width_, height_); |
| 780 base::StringAppendF(&str, "attached_to_window: %d ", attached_to_window_); | 884 base::StringAppendF(&str, "attached_to_window: %d ", attached_to_window_); |
| 781 base::StringAppendF(&str, | 885 base::StringAppendF(&str, |
| 782 "global visible rect: %s ", | 886 "global visible rect: %s ", |
| 783 draw_gl_input_.global_visible_rect.ToString().c_str()); | 887 global_visible_rect_.ToString().c_str()); |
| 784 base::StringAppendF( | 888 base::StringAppendF( |
| 785 &str, "scroll_offset_dip: %s ", scroll_offset_dip_.ToString().c_str()); | 889 &str, "scroll_offset_dip: %s ", scroll_offset_dip_.ToString().c_str()); |
| 786 base::StringAppendF(&str, | 890 base::StringAppendF(&str, |
| 787 "overscroll_rounding_error_: %s ", | 891 "overscroll_rounding_error_: %s ", |
| 788 overscroll_rounding_error_.ToString().c_str()); | 892 overscroll_rounding_error_.ToString().c_str()); |
| 789 base::StringAppendF( | 893 base::StringAppendF( |
| 790 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 894 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
| 791 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 895 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
| 792 if (draw_info) { | 896 if (draw_info) { |
| 793 base::StringAppendF(&str, | 897 base::StringAppendF(&str, |
| 794 "clip left top right bottom: [%d %d %d %d] ", | 898 "clip left top right bottom: [%d %d %d %d] ", |
| 795 draw_info->clip_left, | 899 draw_info->clip_left, |
| 796 draw_info->clip_top, | 900 draw_info->clip_top, |
| 797 draw_info->clip_right, | 901 draw_info->clip_right, |
| 798 draw_info->clip_bottom); | 902 draw_info->clip_bottom); |
| 799 base::StringAppendF(&str, | 903 base::StringAppendF(&str, |
| 800 "surface width height: [%d %d] ", | 904 "surface width height: [%d %d] ", |
| 801 draw_info->width, | 905 draw_info->width, |
| 802 draw_info->height); | 906 draw_info->height); |
| 803 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 907 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 804 } | 908 } |
| 805 return str; | 909 return str; |
| 806 } | 910 } |
| 807 | 911 |
| 808 } // namespace android_webview | 912 } // namespace android_webview |
| OLD | NEW |