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 "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <objidl.h> | 8 #include <objidl.h> |
9 #include <mlang.h> | 9 #include <mlang.h> |
10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 10 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
(...skipping 28 matching lines...) Expand all Loading... | |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h" |
47 #endif | 47 #endif |
48 #include "v8/include/v8.h" | 48 #include "v8/include/v8.h" |
49 #if defined(OS_ANDROID) | |
50 #include "webkit/glue/dalvik_heap_size_android.h" | |
51 #endif | |
49 #include "webkit/glue/glue_serialize.h" | 52 #include "webkit/glue/glue_serialize.h" |
50 #include "webkit/glue/user_agent.h" | 53 #include "webkit/glue/user_agent.h" |
51 | 54 |
52 using WebKit::WebCanvas; | 55 using WebKit::WebCanvas; |
53 using WebKit::WebData; | 56 using WebKit::WebData; |
54 using WebKit::WebDevToolsAgent; | 57 using WebKit::WebDevToolsAgent; |
55 using WebKit::WebElement; | 58 using WebKit::WebElement; |
56 using WebKit::WebFrame; | 59 using WebKit::WebFrame; |
57 using WebKit::WebGlyphCache; | 60 using WebKit::WebGlyphCache; |
58 using WebKit::WebHistoryItem; | 61 using WebKit::WebHistoryItem; |
(...skipping 15 matching lines...) Expand all Loading... | |
74 //------------------------------------------------------------------------------ | 77 //------------------------------------------------------------------------------ |
75 // webkit_glue impl: | 78 // webkit_glue impl: |
76 | 79 |
77 namespace webkit_glue { | 80 namespace webkit_glue { |
78 | 81 |
79 // Global variable used by the plugin quirk "die after unload". | 82 // Global variable used by the plugin quirk "die after unload". |
80 bool g_forcefully_terminate_plugin_process = false; | 83 bool g_forcefully_terminate_plugin_process = false; |
81 | 84 |
82 void SetJavaScriptFlags(const std::string& str) { | 85 void SetJavaScriptFlags(const std::string& str) { |
83 #if WEBKIT_USING_V8 | 86 #if WEBKIT_USING_V8 |
87 #if defined(OS_ANDROID) | |
88 DalvikHeapSize* heap_size_singleton = DalvikHeapSize::GetInstance(); | |
89 // Set V8 heap size to 3/4 of the device heap size. | |
90 int heap_size = std::max(32, heap_size_singleton->HeapSizeMB() / 4 * 3); | |
jamesr
2012/04/20 00:44:26
you're clamping the heap size in dalvik_heap_size_
ulan
2012/04/20 08:55:43
This heap size is for setting V8 heap limit, which
| |
91 int code_size = heap_size / 4; | |
92 std::string heap_flags = base::StringPrintf( | |
93 "--max_old_gen_size=%d --max_executable_size=%d", heap_size, code_size); | |
jamesr
2012/04/20 00:44:26
formatting a string flag is really hacky and very
ulan
2012/04/20 08:55:43
Okay, removing this part from CL, will set this vi
| |
94 v8::V8::SetFlagsFromString(heap_flags.data(), | |
95 static_cast<int>(heap_flags.size())); | |
96 #endif | |
84 v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); | 97 v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size())); |
85 #endif | 98 #endif |
86 } | 99 } |
87 | 100 |
88 void EnableWebCoreLogChannels(const std::string& channels) { | 101 void EnableWebCoreLogChannels(const std::string& channels) { |
89 if (channels.empty()) | 102 if (channels.empty()) |
90 return; | 103 return; |
91 StringTokenizer t(channels, ", "); | 104 StringTokenizer t(channels, ", "); |
92 while (t.GetNext()) { | 105 while (t.GetNext()) { |
93 WebKit::enableLogChannel(t.token().c_str()); | 106 WebKit::enableLogChannel(t.token().c_str()); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 std::string GetInspectorProtocolVersion() { | 505 std::string GetInspectorProtocolVersion() { |
493 return WebDevToolsAgent::inspectorProtocolVersion().utf8(); | 506 return WebDevToolsAgent::inspectorProtocolVersion().utf8(); |
494 } | 507 } |
495 | 508 |
496 bool IsInspectorProtocolVersionSupported(const std::string& version) { | 509 bool IsInspectorProtocolVersionSupported(const std::string& version) { |
497 return WebDevToolsAgent::supportsInspectorProtocolVersion( | 510 return WebDevToolsAgent::supportsInspectorProtocolVersion( |
498 WebString::fromUTF8(version)); | 511 WebString::fromUTF8(version)); |
499 } | 512 } |
500 | 513 |
501 } // namespace webkit_glue | 514 } // namespace webkit_glue |
OLD | NEW |