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

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

Issue 119493005: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Put low end device detection under the flag for all platforms except android. 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
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>
11 #include <objidl.h> 11 #include <objidl.h>
12 #include <mlang.h> 12 #include <mlang.h>
13 #endif 13 #endif
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/sys_info.h" 20 #include "base/sys_info.h"
21 #include "base/sys_utils.h"
21 #include "content/child/child_thread.h" 22 #include "content/child/child_thread.h"
22 #include "content/child/npapi/plugin_instance.h" 23 #include "content/child/npapi/plugin_instance.h"
23 #include "content/child/npapi/plugin_lib.h" 24 #include "content/child/npapi/plugin_lib.h"
24 #include "content/child/site_isolation_policy.h" 25 #include "content/child/site_isolation_policy.h"
25 #include "content/common/view_messages.h" 26 #include "content/common/view_messages.h"
26 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
27 #include "content/public/renderer/content_renderer_client.h" 28 #include "content/public/renderer/content_renderer_client.h"
28 #include "ipc/ipc_channel.h" 29 #include "ipc/ipc_channel.h"
29 #include "ipc/ipc_message_utils.h" 30 #include "ipc/ipc_message_utils.h"
30 #include "skia/ext/platform_canvas.h" 31 #include "skia/ext/platform_canvas.h"
31 #include "third_party/WebKit/public/web/WebFrame.h" 32 #include "third_party/WebKit/public/web/WebFrame.h"
32 #include "ui/surface/transport_dib.h" 33 #include "ui/surface/transport_dib.h"
33 #include "webkit/glue/webkit_glue.h" 34 #include "webkit/glue/webkit_glue.h"
34 35
35 #if defined(OS_MACOSX) 36 #if defined(OS_MACOSX)
36 #include "base/mac/mac_util.h" 37 #include "base/mac/mac_util.h"
37 #endif 38 #endif
38 39
39 #if defined(OS_ANDROID)
40 #include "base/android/sys_utils.h"
41 #endif
42
43 namespace content { 40 namespace content {
44 41
45 RenderProcessImpl::RenderProcessImpl() 42 RenderProcessImpl::RenderProcessImpl()
46 : shared_mem_cache_cleaner_( 43 : shared_mem_cache_cleaner_(
47 FROM_HERE, base::TimeDelta::FromSeconds(5), 44 FROM_HERE, base::TimeDelta::FromSeconds(5),
48 this, &RenderProcessImpl::ClearTransportDIBCache), 45 this, &RenderProcessImpl::ClearTransportDIBCache),
49 transport_dib_next_sequence_number_(0), 46 transport_dib_next_sequence_number_(0),
50 enabled_bindings_(0) { 47 enabled_bindings_(0) {
51 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) 48 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)
52 shared_mem_cache_[i] = NULL; 49 shared_mem_cache_[i] = NULL;
(...skipping 11 matching lines...) Expand all
64 DCHECK(gdi_init_lpk); 61 DCHECK(gdi_init_lpk);
65 if (gdi_init_lpk) { 62 if (gdi_init_lpk) {
66 gdi_init_lpk(0); 63 gdi_init_lpk(0);
67 } 64 }
68 } 65 }
69 #endif 66 #endif
70 67
71 // Out of process dev tools rely upon auto break behavior. 68 // Out of process dev tools rely upon auto break behavior.
72 webkit_glue::SetJavaScriptFlags("--debugger-auto-break"); 69 webkit_glue::SetJavaScriptFlags("--debugger-auto-break");
73 70
74 #if defined(OS_ANDROID) 71 if (base::SysUtils::IsLowEndDevice())
75 if (base::android::SysUtils::IsLowEndDevice())
76 webkit_glue::SetJavaScriptFlags("--optimize-for-size"); 72 webkit_glue::SetJavaScriptFlags("--optimize-for-size");
77 #endif
78 73
79 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 74 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
80 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { 75 if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
81 webkit_glue::SetJavaScriptFlags( 76 webkit_glue::SetJavaScriptFlags(
82 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); 77 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
83 } 78 }
84 79
85 // Turn on cross-site document blocking for renderer processes. 80 // Turn on cross-site document blocking for renderer processes.
86 SiteIsolationPolicy::SetPolicyEnabled( 81 SiteIsolationPolicy::SetPolicyEnabled(
87 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy()); 82 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void RenderProcessImpl::ClearTransportDIBCache() { 231 void RenderProcessImpl::ClearTransportDIBCache() {
237 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { 232 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
238 if (shared_mem_cache_[i]) { 233 if (shared_mem_cache_[i]) {
239 FreeTransportDIB(shared_mem_cache_[i]); 234 FreeTransportDIB(shared_mem_cache_[i]);
240 shared_mem_cache_[i] = NULL; 235 shared_mem_cache_[i] = NULL;
241 } 236 }
242 } 237 }
243 } 238 }
244 239
245 } // namespace content 240 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698