Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 if (!page->mainFrame()->spellChecker().isContinuousSpellCheckingEnabled()) | 200 if (!page->mainFrame()->spellChecker().isContinuousSpellCheckingEnabled()) |
| 201 page->mainFrame()->spellChecker().toggleContinuousSpellChecking(); | 201 page->mainFrame()->spellChecker().toggleContinuousSpellChecking(); |
| 202 if (page->mainFrame()->editor().isOverwriteModeEnabled()) | 202 if (page->mainFrame()->editor().isOverwriteModeEnabled()) |
| 203 page->mainFrame()->editor().toggleOverwriteModeEnabled(); | 203 page->mainFrame()->editor().toggleOverwriteModeEnabled(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 Internals::Internals(Document* document) | 206 Internals::Internals(Document* document) |
| 207 : ContextLifecycleObserver(document) | 207 : ContextLifecycleObserver(document) |
| 208 , m_runtimeFlags(InternalRuntimeFlags::create()) | 208 , m_runtimeFlags(InternalRuntimeFlags::create()) |
| 209 , m_scrollingCoordinator(document->page() ? document->page()->scrollingCoord inator() : 0) | 209 , m_scrollingCoordinator(document->page() ? document->page()->scrollingCoord inator() : 0) |
| 210 , m_gcWithoutContextTimer(this, &Internals::garbageCollectV8WithoutContextTi merFired) | |
| 210 { | 211 { |
| 211 } | 212 } |
| 212 | 213 |
| 213 Document* Internals::contextDocument() const | 214 Document* Internals::contextDocument() const |
| 214 { | 215 { |
| 215 return toDocument(executionContext()); | 216 return toDocument(executionContext()); |
| 216 } | 217 } |
| 217 | 218 |
| 218 Frame* Internals::frame() const | 219 Frame* Internals::frame() const |
| 219 { | 220 { |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2233 if (!sharedContext) | 2234 if (!sharedContext) |
| 2234 return false; | 2235 return false; |
| 2235 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); | 2236 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); |
| 2236 // To prevent tests that call loseSharedGraphicsContext3D from being | 2237 // To prevent tests that call loseSharedGraphicsContext3D from being |
| 2237 // flaky, we call finish so that the context is guaranteed to be lost | 2238 // flaky, we call finish so that the context is guaranteed to be lost |
| 2238 // synchronously (i.e. before returning). | 2239 // synchronously (i.e. before returning). |
| 2239 sharedContext->finish(); | 2240 sharedContext->finish(); |
| 2240 return true; | 2241 return true; |
| 2241 } | 2242 } |
| 2242 | 2243 |
| 2244 void Internals::garbageCollectV8WithoutContext() | |
|
haraken
2013/10/29 01:14:53
garbageCollectV8WithoutContext => collectGarbageWi
| |
| 2245 { | |
| 2246 m_gcWithoutContextTimer.startOneShot(0); | |
|
haraken
2013/10/29 01:14:53
Why do you need a timer?
| |
| 2243 } | 2247 } |
| 2248 | |
| 2249 void Internals::garbageCollectV8WithoutContextTimerFired(Timer<Internals>*) | |
| 2250 { | |
| 2251 const int largeEnoughValueToTriggerMajorGC = 10000; | |
| 2252 for (int i = 0; i < 100; ++i) | |
| 2253 v8::V8::IdleNotification(largeEnoughValueToTriggerMajorGC); | |
|
haraken
2013/10/29 01:14:53
This is not a reliable way to trigger GC. Instead
| |
| 2254 } | |
| 2255 | |
| 2256 } | |
| OLD | NEW |