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

Side by Side Diff: webkit/glue/webkit_glue.cc

Issue 10113009: Set Android/V8 memory limits from dalvik.vm.heapsize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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 "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
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 13 matching lines...) Expand all
72 static const char kFileTestPrefix[] = "(file test):"; 75 static const char kFileTestPrefix[] = "(file test):";
73 76
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) {
tonyg 2012/04/19 16:04:30 This method's contract seems to be to set the flag
ulan 2012/04/19 17:46:24 I am not sure about moving dependency on DalvikHea
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 6/8 of the device heap size.
Erik Corry 2012/04/19 16:52:56 Why not 3/4?
ulan 2012/04/19 17:46:24 Done.
90 int heap_size = std::max(32, heap_size_singleton->HeapSizeMB() / 8 * 6);
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);
Erik Corry 2012/04/19 16:52:56 I think it would be cleaner to use SetResourceCons
ulan 2012/04/19 17:46:24 Proper place to call SetResourceConstraints seems
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698