| OLD | NEW |
| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 // (2) X's DOM wrapper is created. | 444 // (2) X's DOM wrapper is created. |
| 445 // (3) The DOM wrapper becomes unreachable. | 445 // (3) The DOM wrapper becomes unreachable. |
| 446 // (4) V8 triggers a GC. The V8's GC collects the DOM wrapper. | 446 // (4) V8 triggers a GC. The V8's GC collects the DOM wrapper. |
| 447 // However, X is not collected until a next Oilpan's GC is | 447 // However, X is not collected until a next Oilpan's GC is |
| 448 // triggered. | 448 // triggered. |
| 449 // (5) If a lot of such DOM objects are created, we end up with | 449 // (5) If a lot of such DOM objects are created, we end up with |
| 450 // a situation where V8's GC collects the DOM wrappers but | 450 // a situation where V8's GC collects the DOM wrappers but |
| 451 // the DOM objects are not collected forever. (Note that | 451 // the DOM objects are not collected forever. (Note that |
| 452 // Oilpan's GC is not triggered unless Oilpan's heap gets full.) | 452 // Oilpan's GC is not triggered unless Oilpan's heap gets full.) |
| 453 // (6) V8 hits OOM. | 453 // (6) V8 hits OOM. |
| 454 ThreadState::current()->setGCRequested(); | 454 ThreadState::current()->requestGC(); |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 void V8GCController::collectGarbage(v8::Isolate* isolate) | 458 void V8GCController::collectGarbage(v8::Isolate* isolate) |
| 459 { | 459 { |
| 460 v8::HandleScope handleScope(isolate); | 460 v8::HandleScope handleScope(isolate); |
| 461 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); | 461 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); |
| 462 ScriptState::Scope scope(scriptState.get()); | 462 ScriptState::Scope scope(scriptState.get()); |
| 463 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc();
"), isolate); | 463 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc();
"), isolate); |
| 464 scriptState->disposePerContextData(); | 464 scriptState->disposePerContextData(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 Visitor* m_visitor; | 503 Visitor* m_visitor; |
| 504 }; | 504 }; |
| 505 | 505 |
| 506 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) | 506 void V8GCController::traceDOMWrappers(v8::Isolate* isolate, Visitor* visitor) |
| 507 { | 507 { |
| 508 DOMWrapperTracer tracer(visitor); | 508 DOMWrapperTracer tracer(visitor); |
| 509 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); | 509 v8::V8::VisitHandlesWithClassIds(isolate, &tracer); |
| 510 } | 510 } |
| 511 | 511 |
| 512 } // namespace blink | 512 } // namespace blink |
| OLD | NEW |