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

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

Issue 258663002: Expose a low-end device mode override flags for non-android OSs as well (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward command-line flags to renderer and gpu processes Created 6 years, 7 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 "v8/include/v8.h" 34 #include "v8/include/v8.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 : enabled_bindings_(0) { 43 : enabled_bindings_(0) {
47 #if defined(OS_WIN) 44 #if defined(OS_WIN)
48 // HACK: See http://b/issue?id=1024307 for rationale. 45 // HACK: See http://b/issue?id=1024307 for rationale.
49 if (GetModuleHandle(L"LPK.DLL") == NULL) { 46 if (GetModuleHandle(L"LPK.DLL") == NULL) {
50 // Makes sure lpk.dll is loaded by gdi32 to make sure ExtTextOut() works 47 // Makes sure lpk.dll is loaded by gdi32 to make sure ExtTextOut() works
51 // when buffering into a EMF buffer for printing. 48 // when buffering into a EMF buffer for printing.
52 typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs); 49 typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs);
53 GdiInitializeLanguagePack gdi_init_lpk = 50 GdiInitializeLanguagePack gdi_init_lpk =
54 reinterpret_cast<GdiInitializeLanguagePack>(GetProcAddress( 51 reinterpret_cast<GdiInitializeLanguagePack>(GetProcAddress(
55 GetModuleHandle(L"GDI32.DLL"), 52 GetModuleHandle(L"GDI32.DLL"),
56 "GdiInitializeLanguagePack")); 53 "GdiInitializeLanguagePack"));
57 DCHECK(gdi_init_lpk); 54 DCHECK(gdi_init_lpk);
58 if (gdi_init_lpk) { 55 if (gdi_init_lpk) {
59 gdi_init_lpk(0); 56 gdi_init_lpk(0);
60 } 57 }
61 } 58 }
62 #endif 59 #endif
63 60
64 #if defined(OS_ANDROID) 61 if (base::SysUtils::IsLowEndDevice()) {
65 if (base::android::SysUtils::IsLowEndDevice()) {
66 std::string optimize_flag("--optimize-for-size"); 62 std::string optimize_flag("--optimize-for-size");
67 v8::V8::SetFlagsFromString(optimize_flag.c_str(), 63 v8::V8::SetFlagsFromString(optimize_flag.c_str(),
68 static_cast<int>(optimize_flag.size())); 64 static_cast<int>(optimize_flag.size()));
69 } 65 }
70 #endif
71 66
72 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 67 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
73 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { 68 if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
74 std::string flags( 69 std::string flags(
75 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); 70 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
76 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 71 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
77 } 72 }
78 73
79 // Turn on cross-site document blocking for renderer processes. 74 // Turn on cross-site document blocking for renderer processes.
80 SiteIsolationPolicy::SetPolicyEnabled( 75 SiteIsolationPolicy::SetPolicyEnabled(
(...skipping 12 matching lines...) Expand all
93 88
94 void RenderProcessImpl::AddBindings(int bindings) { 89 void RenderProcessImpl::AddBindings(int bindings) {
95 enabled_bindings_ |= bindings; 90 enabled_bindings_ |= bindings;
96 } 91 }
97 92
98 int RenderProcessImpl::GetEnabledBindings() const { 93 int RenderProcessImpl::GetEnabledBindings() const {
99 return enabled_bindings_; 94 return enabled_bindings_;
100 } 95 }
101 96
102 } // namespace content 97 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698