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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp

Issue 1358813002: Oilpan: We shouldn't trigger too many conservative GCs when detaching iframes Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 InspectorInstrumentation::willReleaseScriptContext(frame, m_scriptState. get()); 114 InspectorInstrumentation::willReleaseScriptContext(frame, m_scriptState. get());
115 } 115 }
116 116
117 m_document.clear(); 117 m_document.clear();
118 118
119 if (behavior == DetachGlobal) 119 if (behavior == DetachGlobal)
120 m_scriptState->detachGlobalObject(); 120 m_scriptState->detachGlobalObject();
121 121
122 m_scriptState->disposePerContextData(); 122 m_scriptState->disposePerContextData();
123 123
124 if (ThreadState::current())
125 ThreadState::current()->v8ContextDisposed();
126
124 // It's likely that disposing the context has created a lot of 127 // It's likely that disposing the context has created a lot of
125 // garbage. Notify V8 about this so it'll have a chance of cleaning 128 // garbage. Notify V8 about this so it'll have a chance of cleaning
126 // it up when idle. 129 // it up when idle.
127 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame ()); 130 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame ());
128 } 131 }
129 132
130 void WindowProxy::clearForClose() 133 void WindowProxy::clearForClose()
131 { 134 {
132 if (!isContextInitialized()) 135 if (!isContextInitialized())
133 return; 136 return;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 extensionNames.append(extension->name()); 324 extensionNames.append(extension->name());
322 } 325 }
323 } 326 }
324 v8::ExtensionConfiguration extensionConfiguration(extensionNames.size(), ext ensionNames.data()); 327 v8::ExtensionConfiguration extensionConfiguration(extensionNames.size(), ext ensionNames.data());
325 328
326 v8::Local<v8::Context> context = v8::Context::New(m_isolate, &extensionConfi guration, globalTemplate, m_global.newLocal(m_isolate)); 329 v8::Local<v8::Context> context = v8::Context::New(m_isolate, &extensionConfi guration, globalTemplate, m_global.newLocal(m_isolate));
327 if (context.IsEmpty()) 330 if (context.IsEmpty())
328 return; 331 return;
329 m_scriptState = ScriptState::create(context, m_world); 332 m_scriptState = ScriptState::create(context, m_world);
330 333
334 if (ThreadState::current())
335 ThreadState::current()->v8ContextCreated();
336
331 double contextCreationDurationInMilliseconds = (currentTime() - contextCreat ionStartInSeconds) * 1000; 337 double contextCreationDurationInMilliseconds = (currentTime() - contextCreat ionStartInSeconds) * 1000;
332 const char* histogramName = "WebCore.WindowProxy.createContext.MainWorld"; 338 const char* histogramName = "WebCore.WindowProxy.createContext.MainWorld";
333 if (!m_world->isMainWorld()) 339 if (!m_world->isMainWorld())
334 histogramName = "WebCore.WindowProxy.createContext.IsolatedWorld"; 340 histogramName = "WebCore.WindowProxy.createContext.IsolatedWorld";
335 Platform::current()->histogramCustomCounts(histogramName, contextCreationDur ationInMilliseconds, 0, 10000, 50); 341 Platform::current()->histogramCustomCounts(histogramName, contextCreationDur ationInMilliseconds, 0, 10000, 50);
336 } 342 }
337 343
338 static v8::Local<v8::Object> toInnerGlobalObject(v8::Local<v8::Context> context) 344 static v8::Local<v8::Object> toInnerGlobalObject(v8::Local<v8::Context> context)
339 { 345 {
340 return v8::Local<v8::Object>::Cast(context->Global()->GetPrototype()); 346 return v8::Local<v8::Object>::Cast(context->Global()->GetPrototype());
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 564 }
559 565
560 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) 566 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin)
561 { 567 {
562 if (!isContextInitialized()) 568 if (!isContextInitialized())
563 return; 569 return;
564 setSecurityToken(origin); 570 setSecurityToken(origin);
565 } 571 }
566 572
567 } // namespace blink 573 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698