Chromium Code Reviews| 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/browser/browser_view_renderer_client.h" | 7 #include "android_webview/browser/browser_view_renderer_client.h" |
| 8 #include "android_webview/browser/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
| 9 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
| 10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 const int64 kFallbackTickTimeoutInMilliseconds = 100; | 40 const int64 kFallbackTickTimeoutInMilliseconds = 100; |
| 41 | 41 |
| 42 // Used to calculate memory allocation. Determined experimentally. | 42 // Used to calculate memory allocation. Determined experimentally. |
| 43 const size_t kMemoryMultiplier = 20; | 43 const size_t kMemoryMultiplier = 20; |
| 44 const size_t kBytesPerPixel = 4; | 44 const size_t kBytesPerPixel = 4; |
| 45 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; | 45 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; |
| 46 uint64 g_memory_override_in_bytes = 0u; | 46 uint64 g_memory_override_in_bytes = 0u; |
| 47 | 47 |
| 48 // Used to calculate tile allocation. Determined experimentally. | 48 // Used to calculate tile allocation. Determined experimentally. |
| 49 const size_t kTileMultiplier = 12; | 49 size_t kTileMultiplier = 12; |
| 50 const size_t kTileAllocationStep = 20; | 50 const size_t kTileAllocationStep = 20; |
| 51 // This will be set by static function CalculateTileMemoryPolicy() during init. | 51 // This will be set by static function CalculateTileMemoryPolicy() during init. |
| 52 // See AwMainDelegate::BasicStartupComplete. | 52 // See AwMainDelegate::BasicStartupComplete. |
| 53 size_t g_tile_area; | 53 size_t g_tile_area; |
| 54 | 54 |
| 55 class TracedValue : public base::debug::ConvertableToTraceFormat { | 55 class TracedValue : public base::debug::ConvertableToTraceFormat { |
| 56 public: | 56 public: |
| 57 explicit TracedValue(base::Value* value) : value_(value) {} | 57 explicit TracedValue(base::Value* value) : value_(value) {} |
| 58 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( | 58 static scoped_refptr<base::debug::ConvertableToTraceFormat> FromValue( |
| 59 base::Value* value) { | 59 base::Value* value) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 90 g_memory_override_in_bytes *= 1024 * 1024; | 90 g_memory_override_in_bytes *= 1024 * 1024; |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (!use_zero_copy) { | 93 if (!use_zero_copy) { |
| 94 // Use chrome's default tile size, which varies from 256 to 512. | 94 // Use chrome's default tile size, which varies from 256 to 512. |
| 95 // Be conservative here and use the smallest tile size possible. | 95 // Be conservative here and use the smallest tile size possible. |
| 96 g_tile_area = 256 * 256; | 96 g_tile_area = 256 * 256; |
| 97 | 97 |
| 98 // Also use a high tile limit since there are no file descriptor issues. | 98 // Also use a high tile limit since there are no file descriptor issues. |
| 99 GlobalTileManager::GetInstance()->SetTileLimit(1000); | 99 GlobalTileManager::GetInstance()->SetTileLimit(1000); |
| 100 | |
| 101 kTileMultiplier *= 2; | |
|
hush (inactive)
2014/09/09 00:06:02
why do we do this? By the way, if you want to doub
boliu
2014/09/09 00:07:19
Ahh crap, unrelated change that I didn't mean to u
hush (inactive)
2014/09/09 00:09:45
cool. Get rid of this and other parts lgtm.
You ne
| |
| 100 return; | 102 return; |
| 101 } | 103 } |
| 102 | 104 |
| 103 const char kDefaultTileSize[] = "384"; | 105 const char kDefaultTileSize[] = "384"; |
| 104 | 106 |
| 105 if (!cl->HasSwitch(switches::kDefaultTileWidth)) | 107 if (!cl->HasSwitch(switches::kDefaultTileWidth)) |
| 106 cl->AppendSwitchASCII(switches::kDefaultTileWidth, kDefaultTileSize); | 108 cl->AppendSwitchASCII(switches::kDefaultTileWidth, kDefaultTileSize); |
| 107 | 109 |
| 108 if (!cl->HasSwitch(switches::kDefaultTileHeight)) | 110 if (!cl->HasSwitch(switches::kDefaultTileHeight)) |
| 109 cl->AppendSwitchASCII(switches::kDefaultTileHeight, kDefaultTileSize); | 111 cl->AppendSwitchASCII(switches::kDefaultTileHeight, kDefaultTileSize); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 } | 259 } |
| 258 | 260 |
| 259 // Perform a software draw | 261 // Perform a software draw |
| 260 return OnDrawSoftware(java_canvas); | 262 return OnDrawSoftware(java_canvas); |
| 261 } | 263 } |
| 262 | 264 |
| 263 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { | 265 bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) { |
| 264 if (!compositor_) | 266 if (!compositor_) |
| 265 return false; | 267 return false; |
| 266 | 268 |
| 269 if (last_on_draw_global_visible_rect_.IsEmpty()) | |
| 270 return client_->RequestDrawGL(java_canvas, false); | |
| 271 | |
| 267 if (!hardware_enabled_) { | 272 if (!hardware_enabled_) { |
| 268 hardware_enabled_ = compositor_->InitializeHwDraw(); | 273 hardware_enabled_ = compositor_->InitializeHwDraw(); |
| 269 if (hardware_enabled_) { | 274 if (hardware_enabled_) { |
| 270 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); | 275 tile_manager_key_ = GlobalTileManager::GetInstance()->PushBack(this); |
| 271 gpu::GLInProcessContext* share_context = compositor_->GetShareContext(); | 276 gpu::GLInProcessContext* share_context = compositor_->GetShareContext(); |
| 272 DCHECK(share_context); | 277 DCHECK(share_context); |
| 273 shared_renderer_state_->SetSharedContext(share_context); | 278 shared_renderer_state_->SetSharedContext(share_context); |
| 274 } | 279 } |
| 275 } | 280 } |
| 276 if (!hardware_enabled_) | 281 if (!hardware_enabled_) |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 base::StringAppendF(&str, | 820 base::StringAppendF(&str, |
| 816 "surface width height: [%d %d] ", | 821 "surface width height: [%d %d] ", |
| 817 draw_info->width, | 822 draw_info->width, |
| 818 draw_info->height); | 823 draw_info->height); |
| 819 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 824 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 820 } | 825 } |
| 821 return str; | 826 return str; |
| 822 } | 827 } |
| 823 | 828 |
| 824 } // namespace android_webview | 829 } // namespace android_webview |
| OLD | NEW |