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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase past r182224 conflict Created 6 years, 3 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
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 WebRemoteFrame* WebLocalFrameImpl::toWebRemoteFrame() 491 WebRemoteFrame* WebLocalFrameImpl::toWebRemoteFrame()
492 { 492 {
493 ASSERT_NOT_REACHED(); 493 ASSERT_NOT_REACHED();
494 return 0; 494 return 0;
495 } 495 }
496 496
497 void WebLocalFrameImpl::close() 497 void WebLocalFrameImpl::close()
498 { 498 {
499 m_client = 0; 499 m_client = 0;
500 500
501 #if ENABLE(OILPAN)
502 m_selfKeepAlive.clear();
503 #else
501 deref(); // Balances ref() acquired in WebFrame::create 504 deref(); // Balances ref() acquired in WebFrame::create
505 #endif
502 } 506 }
503 507
504 WebString WebLocalFrameImpl::uniqueName() const 508 WebString WebLocalFrameImpl::uniqueName() const
505 { 509 {
506 return frame()->tree().uniqueName(); 510 return frame()->tree().uniqueName();
507 } 511 }
508 512
509 WebString WebLocalFrameImpl::assignedName() const 513 WebString WebLocalFrameImpl::assignedName() const
510 { 514 {
511 return frame()->tree().name(); 515 return frame()->tree().name();
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 1524
1521 // WebLocalFrameImpl public ---------------------------------------------------- ----- 1525 // WebLocalFrameImpl public ---------------------------------------------------- -----
1522 1526
1523 WebLocalFrame* WebLocalFrame::create(WebFrameClient* client) 1527 WebLocalFrame* WebLocalFrame::create(WebFrameClient* client)
1524 { 1528 {
1525 return WebLocalFrameImpl::create(client); 1529 return WebLocalFrameImpl::create(client);
1526 } 1530 }
1527 1531
1528 WebLocalFrameImpl* WebLocalFrameImpl::create(WebFrameClient* client) 1532 WebLocalFrameImpl* WebLocalFrameImpl::create(WebFrameClient* client)
1529 { 1533 {
1530 return adoptRef(new WebLocalFrameImpl(client)).leakRef(); 1534 WebLocalFrameImpl* frame = new WebLocalFrameImpl(client);
1535 #if ENABLE(OILPAN)
1536 frame->m_selfKeepAlive = frame;
Mads Ager (chromium) 2014/09/18 12:00:59 Maybe move this to the constructor to make sure th
sof 2014/09/18 13:31:15 Good, that's the better place to do it. Done, and
1537 return frame;
1538 #else
1539 return adoptRef(frame).leakRef();
1540 #endif
1531 } 1541 }
1532 1542
1533 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client) 1543 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client)
1534 : m_frameLoaderClientImpl(this) 1544 : m_frameLoaderClientImpl(this)
1535 , m_client(client) 1545 , m_client(client)
1536 , m_permissionClient(0) 1546 , m_permissionClient(0)
1537 , m_inputEventsScaleFactorForEmulation(1) 1547 , m_inputEventsScaleFactorForEmulation(1)
1538 , m_userMediaClientImpl(this) 1548 , m_userMediaClientImpl(this)
1539 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0)) 1549 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0))
1540 { 1550 {
1541 Platform::current()->incrementStatsCounter(webFrameActiveCount); 1551 Platform::current()->incrementStatsCounter(webFrameActiveCount);
1542 frameCount++; 1552 frameCount++;
1543 } 1553 }
1544 1554
1545 WebLocalFrameImpl::~WebLocalFrameImpl() 1555 WebLocalFrameImpl::~WebLocalFrameImpl()
1546 { 1556 {
1547 Platform::current()->decrementStatsCounter(webFrameActiveCount); 1557 Platform::current()->decrementStatsCounter(webFrameActiveCount);
1548 frameCount--; 1558 frameCount--;
1549 1559
1550 cancelPendingScopingEffort(); 1560 cancelPendingScopingEffort();
1551 } 1561 }
1552 1562
1553 void WebLocalFrameImpl::setCoreFrame(PassRefPtr<LocalFrame> frame) 1563 void WebLocalFrameImpl::trace(Visitor* visitor)
1564 {
1565 #if ENABLE(OILPAN)
1566 visitor->trace(m_frame);
1567 visitor->trace(m_printContext);
1568 visitor->trace(m_geolocationClientProxy);
1569
1570 WebFrame::traceChildren(visitor, this);
1571 #endif
1572 }
1573
1574 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame)
1554 { 1575 {
1555 m_frame = frame; 1576 m_frame = frame;
1556 1577
1557 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used. 1578 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used.
1558 if (m_frame) { 1579 if (m_frame) {
1559 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl()); 1580 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl());
1560 if (m_client) 1581 if (m_client)
1561 notificationPresenter->initialize(m_client->notificationPresenter()) ; 1582 notificationPresenter->initialize(m_client->notificationPresenter()) ;
1562 1583
1563 provideNotification(*m_frame, notificationPresenter.release()); 1584 provideNotification(*m_frame, notificationPresenter.release());
1564 provideNotificationPermissionClientTo(*m_frame, NotificationPermissionCl ientImpl::create()); 1585 provideNotificationPermissionClientTo(*m_frame, NotificationPermissionCl ientImpl::create());
1565 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); 1586 provideUserMediaTo(*m_frame, &m_userMediaClientImpl);
1566 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); 1587 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get());
1567 m_geolocationClientProxy->setController(GeolocationController::from(m_fr ame.get())); 1588 m_geolocationClientProxy->setController(GeolocationController::from(m_fr ame.get()));
1568 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web MIDIClient() : 0)); 1589 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web MIDIClient() : 0));
1569 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); 1590 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create());
1570 1591
1571 if (RuntimeEnabledFeatures::screenOrientationEnabled()) 1592 if (RuntimeEnabledFeatures::screenOrientationEnabled())
1572 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client ->webScreenOrientationClient() : 0); 1593 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client ->webScreenOrientationClient() : 0);
1573 } 1594 }
1574 } 1595 }
1575 1596
1576 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, F rameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) 1597 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameH ost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fall backName)
1577 { 1598 {
1578 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner); 1599 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClie ntImpl, host, owner);
1579 setCoreFrame(frame); 1600 setCoreFrame(frame);
1580 frame->tree().setName(name, fallbackName); 1601 frame->tree().setName(name, fallbackName);
1581 // We must call init() after m_frame is assigned because it is referenced 1602 // We must call init() after m_frame is assigned because it is referenced
1582 // during init(). Note that this may dispatch JS events; the frame may be 1603 // during init(). Note that this may dispatch JS events; the frame may be
1583 // detached after init() returns. 1604 // detached after init() returns.
1584 frame->init(); 1605 frame->init();
1585 return frame; 1606 return frame;
1586 } 1607 }
1587 1608
1588 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques t& request, HTMLFrameOwnerElement* ownerElement) 1609 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, HTMLFrameOwnerElement* ownerElement)
1589 { 1610 {
1590 ASSERT(m_client); 1611 ASSERT(m_client);
1591 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, request.frameName())); 1612 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, request.frameName()));
1592 if (!webframeChild) 1613 if (!webframeChild)
1593 return nullptr; 1614 return nullptr;
1594 1615
1595 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1616 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1596 // solution. subResourceAttributeName returns just one attribute name. The 1617 // solution. subResourceAttributeName returns just one attribute name. The
1597 // element might not have the attribute, and there might be other attributes 1618 // element might not have the attribute, and there might be other attributes
1598 // which can identify the element. 1619 // which can identify the element.
1599 RefPtr<LocalFrame> child = webframeChild->initializeCoreFrame(frame()->host( ), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement->s ubResourceAttributeName())); 1620 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, request.frameName(), ownerElement->getAttribute(own erElement->subResourceAttributeName()));
1600 // Initializing the core frame may cause the new child to be detached, since 1621 // Initializing the core frame may cause the new child to be detached, since
1601 // it may dispatch a load event in the parent. 1622 // it may dispatch a load event in the parent.
1602 if (!child->tree().parent()) 1623 if (!child->tree().parent())
1603 return nullptr; 1624 return nullptr;
1604 1625
1605 // If we're moving in the back/forward list, we might want to replace the co ntent 1626 // If we're moving in the back/forward list, we might want to replace the co ntent
1606 // of this child frame with whatever was there at that point. 1627 // of this child frame with whatever was there at that point.
1607 RefPtr<HistoryItem> childItem; 1628 RefPtr<HistoryItem> childItem;
1608 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished()) 1629 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished())
1609 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem ForNewChildFrame(webframeChild)); 1630 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem ForNewChildFrame(webframeChild));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 1898
1878 void WebLocalFrameImpl::invalidateAll() const 1899 void WebLocalFrameImpl::invalidateAll() const
1879 { 1900 {
1880 ASSERT(frame() && frame()->view()); 1901 ASSERT(frame() && frame()->view());
1881 FrameView* view = frame()->view(); 1902 FrameView* view = frame()->view();
1882 view->invalidateRect(view->frameRect()); 1903 view->invalidateRect(view->frameRect());
1883 invalidateScrollbar(); 1904 invalidateScrollbar();
1884 } 1905 }
1885 1906
1886 } // namespace blink 1907 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698