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

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: Created 7 years 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 in_process_plugins_ = InProcessPlugins(); 48 in_process_plugins_ = InProcessPlugins();
52 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) 49 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)
(...skipping 12 matching lines...) Expand all
65 DCHECK(gdi_init_lpk); 62 DCHECK(gdi_init_lpk);
66 if (gdi_init_lpk) { 63 if (gdi_init_lpk) {
67 gdi_init_lpk(0); 64 gdi_init_lpk(0);
68 } 65 }
69 } 66 }
70 #endif 67 #endif
71 68
72 // Out of process dev tools rely upon auto break behavior. 69 // Out of process dev tools rely upon auto break behavior.
73 webkit_glue::SetJavaScriptFlags("--debugger-auto-break"); 70 webkit_glue::SetJavaScriptFlags("--debugger-auto-break");
74 71
75 #if defined(OS_ANDROID) 72 if (base::SysUtils::IsLowEndDevice())
76 if (base::android::SysUtils::IsLowEndDevice())
77 webkit_glue::SetJavaScriptFlags("--optimize-for-size"); 73 webkit_glue::SetJavaScriptFlags("--optimize-for-size");
78 #endif
79 74
80 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 75 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
81 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { 76 if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
82 webkit_glue::SetJavaScriptFlags( 77 webkit_glue::SetJavaScriptFlags(
83 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); 78 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
84 } 79 }
85 80
86 // Turn on cross-site document blocking for renderer processes. 81 // Turn on cross-site document blocking for renderer processes.
87 SiteIsolationPolicy::SetPolicyEnabled( 82 SiteIsolationPolicy::SetPolicyEnabled(
88 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy()); 83 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy());
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 void RenderProcessImpl::ClearTransportDIBCache() { 250 void RenderProcessImpl::ClearTransportDIBCache() {
256 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { 251 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
257 if (shared_mem_cache_[i]) { 252 if (shared_mem_cache_[i]) {
258 FreeTransportDIB(shared_mem_cache_[i]); 253 FreeTransportDIB(shared_mem_cache_[i]);
259 shared_mem_cache_[i] = NULL; 254 shared_mem_cache_[i] = NULL;
260 } 255 }
261 } 256 }
262 } 257 }
263 258
264 } // namespace content 259 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698