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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2529353002: [wrapper-tracing] Avoid GC during PostMessageTimer construction (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 m_navigator = Navigator::create(frame()); 618 m_navigator = Navigator::create(frame());
619 return m_navigator.get(); 619 return m_navigator.get();
620 } 620 }
621 621
622 void LocalDOMWindow::schedulePostMessage(MessageEvent* event, 622 void LocalDOMWindow::schedulePostMessage(MessageEvent* event,
623 PassRefPtr<SecurityOrigin> target, 623 PassRefPtr<SecurityOrigin> target,
624 Document* source) { 624 Document* source) {
625 // Allowing unbounded amounts of messages to build up for a suspended context 625 // Allowing unbounded amounts of messages to build up for a suspended context
626 // is problematic; consider imposing a limit or other restriction if this 626 // is problematic; consider imposing a limit or other restriction if this
627 // surfaces often as a problem (see crbug.com/587012). 627 // surfaces often as a problem (see crbug.com/587012).
628 PostMessageTimer* timer = new PostMessageTimer( 628 std::unique_ptr<SourceLocation> location = SourceLocation::capture(source);
sof 2016/11/29 09:15:44 Subtle staging of allocations going on here wrt 'n
Michael Lippautz 2016/11/29 09:51:41 Sorry, for not leaving a comment. The rationale is
629 *this, event, std::move(target), SourceLocation::capture(source), 629 PostMessageTimer* timer =
630 UserGestureIndicator::currentToken()); 630 new PostMessageTimer(*this, event, std::move(target), std::move(location),
631 UserGestureIndicator::currentToken());
631 timer->startOneShot(0, BLINK_FROM_HERE); 632 timer->startOneShot(0, BLINK_FROM_HERE);
632 timer->suspendIfNeeded(); 633 timer->suspendIfNeeded();
633 m_postMessageTimers.add(timer); 634 m_postMessageTimers.add(timer);
634 } 635 }
635 636
636 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) { 637 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) {
637 if (!isCurrentlyDisplayedInFrame()) 638 if (!isCurrentlyDisplayedInFrame())
638 return; 639 return;
639 640
640 MessageEvent* event = timer->event(); 641 MessageEvent* event = timer->event();
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1563
1563 LocalFrame* LocalDOMWindow::frame() const { 1564 LocalFrame* LocalDOMWindow::frame() const {
1564 // If the LocalDOMWindow still has a frame reference, that frame must point 1565 // If the LocalDOMWindow still has a frame reference, that frame must point
1565 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1566 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1566 // where script execution leaks between different LocalDOMWindows. 1567 // where script execution leaks between different LocalDOMWindows.
1567 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); 1568 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this);
1568 return m_frame; 1569 return m_frame;
1569 } 1570 }
1570 1571
1571 } // namespace blink 1572 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698