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

Side by Side Diff: sky/engine/bindings/core/v8/V8GCController.cpp

Issue 776143003: Remove Isolated Worlds from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 v8::HandleScope scope(isolate); 385 v8::HandleScope scope(isolate);
386 386
387 TRACE_EVENT_END0("v8", "majorGC"); 387 TRACE_EVENT_END0("v8", "majorGC");
388 if (isMainThread()) 388 if (isMainThread())
389 ScriptForbiddenScope::exit(); 389 ScriptForbiddenScope::exit();
390 } 390 }
391 391
392 void V8GCController::collectGarbage(v8::Isolate* isolate) 392 void V8GCController::collectGarbage(v8::Isolate* isolate)
393 { 393 {
394 v8::HandleScope handleScope(isolate); 394 v8::HandleScope handleScope(isolate);
395 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola te), DOMWrapperWorld::create()); 395 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola te), DOMWrapperWorld::create(FakeWorld));
396 ScriptState::Scope scope(scriptState.get()); 396 ScriptState::Scope scope(scriptState.get());
397 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc(); "), isolate); 397 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc(); "), isolate);
398 scriptState->disposePerContextData(); 398 scriptState->disposePerContextData();
399 } 399 }
400 400
401 void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate) 401 void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate)
402 { 402 {
403 if (!isMainThread()) 403 if (!isMainThread())
404 return; 404 return;
405 405
406 static size_t lastUsageReportedToV8 = 0; 406 static size_t lastUsageReportedToV8 = 0;
407 407
408 size_t currentUsage = Partitions::currentDOMMemoryUsage(); 408 size_t currentUsage = Partitions::currentDOMMemoryUsage();
409 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8); 409 int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(las tUsageReportedToV8);
410 isolate->AdjustAmountOfExternalAllocatedMemory(diff); 410 isolate->AdjustAmountOfExternalAllocatedMemory(diff);
411 411
412 lastUsageReportedToV8 = currentUsage; 412 lastUsageReportedToV8 = currentUsage;
413 } 413 }
414 414
415 } // namespace blink 415 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/engine/bindings/core/v8/V8PerIsolateData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698