| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 private: | 69 private: |
| 70 virtual ~TracedValue() {} | 70 virtual ~TracedValue() {} |
| 71 scoped_ptr<base::Value> value_; | 71 scoped_ptr<base::Value> value_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(TracedValue); | 73 DISALLOW_COPY_AND_ASSIGN(TracedValue); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void BrowserViewRenderer::CalculateTileMemoryPolicy(bool use_zero_copy) { | 79 void BrowserViewRenderer::CalculateTileMemoryPolicy() { |
| 80 CommandLine* cl = CommandLine::ForCurrentProcess(); | 80 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 81 | 81 |
| 82 // If the value was overridden on the command line, use the specified value. | 82 // If the value was overridden on the command line, use the specified value. |
| 83 bool client_hard_limit_bytes_overridden = | 83 bool client_hard_limit_bytes_overridden = |
| 84 cl->HasSwitch(switches::kForceGpuMemAvailableMb); | 84 cl->HasSwitch(switches::kForceGpuMemAvailableMb); |
| 85 if (client_hard_limit_bytes_overridden) { | 85 if (client_hard_limit_bytes_overridden) { |
| 86 base::StringToUint64( | 86 base::StringToUint64( |
| 87 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 87 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 88 switches::kForceGpuMemAvailableMb), | 88 switches::kForceGpuMemAvailableMb), |
| 89 &g_memory_override_in_bytes); | 89 &g_memory_override_in_bytes); |
| 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 // 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. | 94 // Be conservative here and use the smallest tile size possible. |
| 95 // Be conservative here and use the smallest tile size possible. | 95 g_tile_area = 256 * 256; |
| 96 g_tile_area = 256 * 256; | |
| 97 | 96 |
| 98 // Also use a high tile limit since there are no file descriptor issues. | 97 // Also use a high tile limit since there are no file descriptor issues. |
| 99 GlobalTileManager::GetInstance()->SetTileLimit(1000); | 98 GlobalTileManager::GetInstance()->SetTileLimit(1000); |
| 100 return; | |
| 101 } | |
| 102 | |
| 103 const char kDefaultTileSize[] = "384"; | |
| 104 | |
| 105 if (!cl->HasSwitch(switches::kDefaultTileWidth)) | |
| 106 cl->AppendSwitchASCII(switches::kDefaultTileWidth, kDefaultTileSize); | |
| 107 | |
| 108 if (!cl->HasSwitch(switches::kDefaultTileHeight)) | |
| 109 cl->AppendSwitchASCII(switches::kDefaultTileHeight, kDefaultTileSize); | |
| 110 | |
| 111 size_t tile_size; | |
| 112 base::StringToSizeT(kDefaultTileSize, &tile_size); | |
| 113 g_tile_area = tile_size * tile_size; | |
| 114 } | 99 } |
| 115 | 100 |
| 116 BrowserViewRenderer::BrowserViewRenderer( | 101 BrowserViewRenderer::BrowserViewRenderer( |
| 117 BrowserViewRendererClient* client, | 102 BrowserViewRendererClient* client, |
| 118 SharedRendererState* shared_renderer_state, | 103 SharedRendererState* shared_renderer_state, |
| 119 content::WebContents* web_contents, | 104 content::WebContents* web_contents, |
| 120 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) | 105 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) |
| 121 : client_(client), | 106 : client_(client), |
| 122 shared_renderer_state_(shared_renderer_state), | 107 shared_renderer_state_(shared_renderer_state), |
| 123 web_contents_(web_contents), | 108 web_contents_(web_contents), |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 base::StringAppendF(&str, | 805 base::StringAppendF(&str, |
| 821 "surface width height: [%d %d] ", | 806 "surface width height: [%d %d] ", |
| 822 draw_info->width, | 807 draw_info->width, |
| 823 draw_info->height); | 808 draw_info->height); |
| 824 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 809 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
| 825 } | 810 } |
| 826 return str; | 811 return str; |
| 827 } | 812 } |
| 828 | 813 |
| 829 } // namespace android_webview | 814 } // namespace android_webview |
| OLD | NEW |