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

Side by Side Diff: content/renderer/render_process_impl.cc

Issue 24210017: [Android] Set --optimize-for-size JavaScript flag for low-end devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync Created 7 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/render_process_impl.h" 5 #include "content/renderer/render_process_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 18 matching lines...) Expand all
29 #include "ipc/ipc_message_utils.h" 29 #include "ipc/ipc_message_utils.h"
30 #include "skia/ext/platform_canvas.h" 30 #include "skia/ext/platform_canvas.h"
31 #include "third_party/WebKit/public/web/WebFrame.h" 31 #include "third_party/WebKit/public/web/WebFrame.h"
32 #include "ui/surface/transport_dib.h" 32 #include "ui/surface/transport_dib.h"
33 #include "webkit/glue/webkit_glue.h" 33 #include "webkit/glue/webkit_glue.h"
34 34
35 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
36 #include "base/mac/mac_util.h" 36 #include "base/mac/mac_util.h"
37 #endif 37 #endif
38 38
39 #if defined(OS_ANDROID)
40 #include "base/android/sys_utils.h"
41 #endif
42
39 namespace content { 43 namespace content {
40 44
41 RenderProcessImpl::RenderProcessImpl() 45 RenderProcessImpl::RenderProcessImpl()
42 : shared_mem_cache_cleaner_( 46 : shared_mem_cache_cleaner_(
43 FROM_HERE, base::TimeDelta::FromSeconds(5), 47 FROM_HERE, base::TimeDelta::FromSeconds(5),
44 this, &RenderProcessImpl::ClearTransportDIBCache), 48 this, &RenderProcessImpl::ClearTransportDIBCache),
45 transport_dib_next_sequence_number_(0), 49 transport_dib_next_sequence_number_(0),
46 enabled_bindings_(0) { 50 enabled_bindings_(0) {
47 in_process_plugins_ = InProcessPlugins(); 51 in_process_plugins_ = InProcessPlugins();
48 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) 52 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)
(...skipping 12 matching lines...) Expand all
61 DCHECK(gdi_init_lpk); 65 DCHECK(gdi_init_lpk);
62 if (gdi_init_lpk) { 66 if (gdi_init_lpk) {
63 gdi_init_lpk(0); 67 gdi_init_lpk(0);
64 } 68 }
65 } 69 }
66 #endif 70 #endif
67 71
68 // Out of process dev tools rely upon auto break behavior. 72 // Out of process dev tools rely upon auto break behavior.
69 webkit_glue::SetJavaScriptFlags("--debugger-auto-break"); 73 webkit_glue::SetJavaScriptFlags("--debugger-auto-break");
70 74
75 #if defined(OS_ANDROID)
76 if (base::android::SysUtils::IsLowEndDevice())
77 webkit_glue::SetJavaScriptFlags("--optimize-for-size");
78 #endif
79
71 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 80 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
72 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { 81 if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
73 webkit_glue::SetJavaScriptFlags( 82 webkit_glue::SetJavaScriptFlags(
74 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); 83 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
75 } 84 }
76 85
77 // Turn on cross-site document blocking for renderer processes. 86 // Turn on cross-site document blocking for renderer processes.
78 SiteIsolationPolicy::SetPolicyEnabled( 87 SiteIsolationPolicy::SetPolicyEnabled(
79 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy()); 88 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy());
80 } 89 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void RenderProcessImpl::ClearTransportDIBCache() { 255 void RenderProcessImpl::ClearTransportDIBCache() {
247 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { 256 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
248 if (shared_mem_cache_[i]) { 257 if (shared_mem_cache_[i]) {
249 FreeTransportDIB(shared_mem_cache_[i]); 258 FreeTransportDIB(shared_mem_cache_[i]);
250 shared_mem_cache_[i] = NULL; 259 shared_mem_cache_[i] = NULL;
251 } 260 }
252 } 261 }
253 } 262 }
254 263
255 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698