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

Side by Side Diff: gin/v8_platform.cc

Issue 2731913002: NotForReview: Expose the global memory budget (chromium side)
Patch Set: Add --simulate-memory-pressure Created 3 years, 9 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
« no previous file with comments | « gin/public/v8_platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "gin/public/v8_platform.h" 5 #include "gin/public/v8_platform.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/memory_coordinator_proxy.h"
9 #include "base/sys_info.h" 10 #include "base/sys_info.h"
10 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
11 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
12 #include "gin/per_isolate_data.h" 13 #include "gin/per_isolate_data.h"
13 14
14 namespace gin { 15 namespace gin {
15 16
16 namespace { 17 namespace {
17 18
18 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER; 19 base::LazyInstance<V8Platform>::Leaky g_v8_platform = LAZY_INSTANCE_INITIALIZER;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void V8Platform::AddTraceStateObserver( 257 void V8Platform::AddTraceStateObserver(
257 v8::Platform::TraceStateObserver* observer) { 258 v8::Platform::TraceStateObserver* observer) {
258 g_trace_state_dispatcher.Get().AddObserver(observer); 259 g_trace_state_dispatcher.Get().AddObserver(observer);
259 } 260 }
260 261
261 void V8Platform::RemoveTraceStateObserver( 262 void V8Platform::RemoveTraceStateObserver(
262 v8::Platform::TraceStateObserver* observer) { 263 v8::Platform::TraceStateObserver* observer) {
263 g_trace_state_dispatcher.Get().RemoveObserver(observer); 264 g_trace_state_dispatcher.Get().RemoveObserver(observer);
264 } 265 }
265 266
267 bool V8Platform::IsGlobalMemoryBudgetAvailable() {
268 return base::MemoryCoordinatorProxy::GetInstance()->IsEnabled();
269 }
270
271 int64_t V8Platform::GetGlobalMemoryBudget() {
272 return base::MemoryCoordinatorProxy::GetInstance()->GetGlobalBudget();
273 }
274
275 void V8Platform::SetGlobalMemoryBudgetUpdateInterval(uint32_t interval) {
276 base::MemoryCoordinatorProxy::GetInstance()->SetGlobalBudgetUpdateInterval(
277 interval);
278 }
279
266 } // namespace gin 280 } // namespace gin
OLDNEW
« no previous file with comments | « gin/public/v8_platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698