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

Unified Diff: src/defaults.cc

Issue 29053002: Provide a mechanism for the embedder to set a TotalPhysicalMemory callback function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« src/api.cc ('K') | « src/api.cc ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/defaults.cc
diff --git a/src/defaults.cc b/src/defaults.cc
index cbbe53729ebd171772106b589ae8b8c6fb4488d1..913d094ad59a2a6c97aed80ffa6f2f3a8959930b 100644
--- a/src/defaults.cc
+++ b/src/defaults.cc
@@ -50,7 +50,15 @@ bool ConfigureResourceConstraintsForCurrentPlatform(
return false;
}
- uint64_t physical_memory = i::OS::TotalPhysicalMemory();
+ uint64_t physical_memory;
+ i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+ if (isolate != NULL &&
+ isolate->thread_local_top()->total_physical_memory_callback_ != NULL) {
+ physical_memory =
+ isolate->thread_local_top()->total_physical_memory_callback_();
+ } else {
+ physical_memory = i::OS::TotalPhysicalMemory();
+ }
int lump_of_memory = (i::kPointerSize / 4) * i::MB;
// The young_space_size should be a power of 2 and old_generation_size should
« src/api.cc ('K') | « src/api.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698