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

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

Issue 124063003: [NOT FOR COMMIT] Hacks to get hardware canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mass corruption on detach Created 6 years, 11 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 | android_webview/lib/main/aw_main_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_view_renderer.h" 5 #include "android_webview/browser/in_process_view_renderer.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "android_webview/browser/aw_gl_surface.h" 9 #include "android_webview/browser/aw_gl_surface.h"
10 #include "android_webview/browser/scoped_app_gl_state_restore.h" 10 #include "android_webview/browser/scoped_app_gl_state_restore.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 bool HardwareEnabled() { 130 bool HardwareEnabled() {
131 static bool g_hw_enabled = !CommandLine::ForCurrentProcess()->HasSwitch( 131 static bool g_hw_enabled = !CommandLine::ForCurrentProcess()->HasSwitch(
132 switches::kDisableWebViewGLMode); 132 switches::kDisableWebViewGLMode);
133 return g_hw_enabled; 133 return g_hw_enabled;
134 } 134 }
135 135
136 // Provides software rendering functions from the Android glue layer. 136 // Provides software rendering functions from the Android glue layer.
137 // Allows preventing extra copies of data when rendering. 137 // Allows preventing extra copies of data when rendering.
138 AwDrawSWFunctionTable* g_sw_draw_functions = NULL; 138 AwDrawSWFunctionTable* g_sw_draw_functions = NULL;
139 139
140 const int64 kFallbackTickTimeoutInMilliseconds = 20; 140 const int64 kFallbackTickTimeoutInMilliseconds = 200;
141 141
142 142
143 // Used to calculate memory and resource allocation. Determined experimentally. 143 // Used to calculate memory and resource allocation. Determined experimentally.
144 size_t g_memory_multiplier = 10; 144 size_t g_memory_multiplier = 10;
145 size_t g_num_gralloc_limit = 150; 145 size_t g_num_gralloc_limit = 150;
146 const size_t kBytesPerPixel = 4; 146 const size_t kBytesPerPixel = 4;
147 const size_t kMemoryAllocationStep = 5 * 1024 * 1024; 147 const size_t kMemoryAllocationStep = 5 * 1024 * 1024;
148 148
149 class ScopedAllowGL { 149 class ScopedAllowGL {
150 public: 150 public:
(...skipping 29 matching lines...) Expand all
180 BrowserThread::PostTask( 180 BrowserThread::PostTask(
181 BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread)); 181 BrowserThread::UI, FROM_HERE, base::Bind(&RequestProcessGLOnUIThread));
182 return; 182 return;
183 } 183 }
184 184
185 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>( 185 InProcessViewRenderer* renderer = static_cast<InProcessViewRenderer*>(
186 g_view_renderer_manager.Get().GetMostRecentlyDrawn()); 186 g_view_renderer_manager.Get().GetMostRecentlyDrawn());
187 if (!renderer || !renderer->RequestProcessGL()) { 187 if (!renderer || !renderer->RequestProcessGL()) {
188 LOG(ERROR) << "Failed to request GL process. Deadlock likely: " 188 LOG(ERROR) << "Failed to request GL process. Deadlock likely: "
189 << !!renderer; 189 << !!renderer;
190 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread();
190 } 191 }
191 } 192 }
192 193
193 } // namespace 194 } // namespace
194 195
195 // Called from different threads! 196 // Called from different threads!
196 static void ScheduleGpuWork() { 197 static void ScheduleGpuWork() {
197 if (ScopedAllowGL::IsAllowed()) { 198 if (ScopedAllowGL::IsAllowed()) {
198 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread(); 199 gpu::InProcessCommandBuffer::ProcessGpuWorkOnCurrentThread();
199 } else { 200 } else {
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 base::StringAppendF(&str, 989 base::StringAppendF(&str,
989 "surface width height: [%d %d] ", 990 "surface width height: [%d %d] ",
990 draw_info->width, 991 draw_info->width,
991 draw_info->height); 992 draw_info->height);
992 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); 993 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer);
993 } 994 }
994 return str; 995 return str;
995 } 996 }
996 997
997 } // namespace android_webview 998 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/lib/main/aw_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698