| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 #include "content/child/npapi/plugin_lib.h" | 23 #include "content/child/npapi/plugin_lib.h" |
| 24 #include "content/child/site_isolation_policy.h" | 24 #include "content/child/site_isolation_policy.h" |
| 25 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
| 26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/renderer/content_renderer_client.h" | 27 #include "content/public/renderer/content_renderer_client.h" |
| 28 #include "ipc/ipc_channel.h" | 28 #include "ipc/ipc_channel.h" |
| 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 "v8/include/v8.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) | 39 #if defined(OS_ANDROID) |
| 40 #include "base/android/sys_utils.h" | 40 #include "base/android/sys_utils.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 namespace content { | 43 namespace content { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 62 GetModuleHandle(L"GDI32.DLL"), | 62 GetModuleHandle(L"GDI32.DLL"), |
| 63 "GdiInitializeLanguagePack")); | 63 "GdiInitializeLanguagePack")); |
| 64 DCHECK(gdi_init_lpk); | 64 DCHECK(gdi_init_lpk); |
| 65 if (gdi_init_lpk) { | 65 if (gdi_init_lpk) { |
| 66 gdi_init_lpk(0); | 66 gdi_init_lpk(0); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 // Out of process dev tools rely upon auto break behavior. | 71 // Out of process dev tools rely upon auto break behavior. |
| 72 webkit_glue::SetJavaScriptFlags("--debugger-auto-break"); | 72 static const char auto_break_flag[] = "--debugger-auto-break"; |
| 73 v8::V8::SetFlagsFromString(auto_break_flag, sizeof(auto_break_flag) - 1); |
| 73 | 74 |
| 74 #if defined(OS_ANDROID) | 75 #if defined(OS_ANDROID) |
| 75 if (base::android::SysUtils::IsLowEndDevice()) | 76 if (base::android::SysUtils::IsLowEndDevice()) { |
| 76 webkit_glue::SetJavaScriptFlags("--optimize-for-size"); | 77 static const char optimize_flag[] = "--optimize-for-size"; |
| 78 v8::V8::SetFlagsFromString(optimize_flag, sizeof(optimize_flag) - 1); |
| 79 } |
| 77 #endif | 80 #endif |
| 78 | 81 |
| 79 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 82 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 80 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { | 83 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { |
| 81 webkit_glue::SetJavaScriptFlags( | 84 v8::V8::SetFlagsFromString( |
| 82 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); | 85 switches::kJavaScriptFlags, |
| 86 static_cast<int>(strlen(switches::kJavaScriptFlags))); |
| 83 } | 87 } |
| 84 | 88 |
| 85 // Turn on cross-site document blocking for renderer processes. | 89 // Turn on cross-site document blocking for renderer processes. |
| 86 SiteIsolationPolicy::SetPolicyEnabled( | 90 SiteIsolationPolicy::SetPolicyEnabled( |
| 87 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy()); | 91 GetContentClient()->renderer()->ShouldEnableSiteIsolationPolicy()); |
| 88 } | 92 } |
| 89 | 93 |
| 90 RenderProcessImpl::~RenderProcessImpl() { | 94 RenderProcessImpl::~RenderProcessImpl() { |
| 91 #ifndef NDEBUG | 95 #ifndef NDEBUG |
| 92 int count = blink::WebFrame::instanceCount(); | 96 int count = blink::WebFrame::instanceCount(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 void RenderProcessImpl::ClearTransportDIBCache() { | 240 void RenderProcessImpl::ClearTransportDIBCache() { |
| 237 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 241 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
| 238 if (shared_mem_cache_[i]) { | 242 if (shared_mem_cache_[i]) { |
| 239 FreeTransportDIB(shared_mem_cache_[i]); | 243 FreeTransportDIB(shared_mem_cache_[i]); |
| 240 shared_mem_cache_[i] = NULL; | 244 shared_mem_cache_[i] = NULL; |
| 241 } | 245 } |
| 242 } | 246 } |
| 243 } | 247 } |
| 244 | 248 |
| 245 } // namespace content | 249 } // namespace content |
| OLD | NEW |