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

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: Handle FrameHost-detached access in FrameLoader::allowPlugins() 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
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebPagePopupImpl.cpp » ('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) 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 WebRemoteFrame* WebLocalFrameImpl::toWebRemoteFrame() 490 WebRemoteFrame* WebLocalFrameImpl::toWebRemoteFrame()
491 { 491 {
492 ASSERT_NOT_REACHED(); 492 ASSERT_NOT_REACHED();
493 return 0; 493 return 0;
494 } 494 }
495 495
496 void WebLocalFrameImpl::close() 496 void WebLocalFrameImpl::close()
497 { 497 {
498 m_client = 0; 498 m_client = 0;
499 499
500 if (m_frame)
501 m_frame->setHasBeenClosed();
502
503 #if !ENABLE(OILPAN)
500 deref(); // Balances ref() acquired in WebFrame::create 504 deref(); // Balances ref() acquired in WebFrame::create
505 #endif
501 } 506 }
502 507
503 WebString WebLocalFrameImpl::uniqueName() const 508 WebString WebLocalFrameImpl::uniqueName() const
504 { 509 {
505 return frame()->tree().uniqueName(); 510 return frame()->tree().uniqueName();
506 } 511 }
507 512
508 WebString WebLocalFrameImpl::assignedName() const 513 WebString WebLocalFrameImpl::assignedName() const
509 { 514 {
510 return frame()->tree().name(); 515 return frame()->tree().name();
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 1520
1516 // WebLocalFrameImpl public ---------------------------------------------------- ----- 1521 // WebLocalFrameImpl public ---------------------------------------------------- -----
1517 1522
1518 WebLocalFrame* WebLocalFrame::create(WebFrameClient* client) 1523 WebLocalFrame* WebLocalFrame::create(WebFrameClient* client)
1519 { 1524 {
1520 return WebLocalFrameImpl::create(client); 1525 return WebLocalFrameImpl::create(client);
1521 } 1526 }
1522 1527
1523 WebLocalFrameImpl* WebLocalFrameImpl::create(WebFrameClient* client) 1528 WebLocalFrameImpl* WebLocalFrameImpl::create(WebFrameClient* client)
1524 { 1529 {
1525 return adoptRef(new WebLocalFrameImpl(client)).leakRef(); 1530 WebLocalFrameImpl* frame = new WebLocalFrameImpl(client);
1531 #if ENABLE(OILPAN)
1532 return frame;
1533 #else
1534 return adoptRef(frame).leakRef();
1535 #endif
1526 } 1536 }
1527 1537
1528 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client) 1538 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client)
1529 : m_frameLoaderClientImpl(this) 1539 : m_frameLoaderClientImpl(this)
1530 , m_client(client) 1540 , m_client(client)
1531 , m_permissionClient(0) 1541 , m_permissionClient(0)
1532 , m_inputEventsScaleFactorForEmulation(1) 1542 , m_inputEventsScaleFactorForEmulation(1)
1533 , m_userMediaClientImpl(this) 1543 , m_userMediaClientImpl(this)
1534 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0)) 1544 , m_geolocationClientProxy(GeolocationClientProxy::create(client ? client->g eolocationClient() : 0))
1535 { 1545 {
1536 Platform::current()->incrementStatsCounter(webFrameActiveCount); 1546 Platform::current()->incrementStatsCounter(webFrameActiveCount);
1537 frameCount++; 1547 frameCount++;
1538 } 1548 }
1539 1549
1540 WebLocalFrameImpl::~WebLocalFrameImpl() 1550 WebLocalFrameImpl::~WebLocalFrameImpl()
1541 { 1551 {
1542 Platform::current()->decrementStatsCounter(webFrameActiveCount); 1552 Platform::current()->decrementStatsCounter(webFrameActiveCount);
1543 frameCount--; 1553 frameCount--;
1544 1554
1545 cancelPendingScopingEffort(); 1555 cancelPendingScopingEffort();
1546 } 1556 }
1547 1557
1548 void WebLocalFrameImpl::setCoreFrame(PassRefPtr<LocalFrame> frame) 1558 void WebLocalFrameImpl::trace(Visitor* visitor)
1559 {
1560 visitor->trace(m_frame);
1561 visitor->trace(m_printContext);
1562 visitor->trace(m_geolocationClientProxy);
1563
1564 WebFrame::trace(visitor, this);
1565 }
1566
1567 void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame)
1549 { 1568 {
1550 m_frame = frame; 1569 m_frame = frame;
1551 1570
1552 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used. 1571 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used.
1553 if (m_frame) { 1572 if (m_frame) {
1554 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl()); 1573 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl());
1555 if (m_client) 1574 if (m_client)
1556 notificationPresenter->initialize(m_client->notificationPresenter()) ; 1575 notificationPresenter->initialize(m_client->notificationPresenter()) ;
1557 1576
1558 provideNotification(*m_frame, notificationPresenter.release()); 1577 provideNotification(*m_frame, notificationPresenter.release());
1559 provideNotificationPermissionClientTo(*m_frame, NotificationPermissionCl ientImpl::create()); 1578 provideNotificationPermissionClientTo(*m_frame, NotificationPermissionCl ientImpl::create());
1560 provideUserMediaTo(*m_frame, &m_userMediaClientImpl); 1579 provideUserMediaTo(*m_frame, &m_userMediaClientImpl);
1561 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get()); 1580 provideGeolocationTo(*m_frame, m_geolocationClientProxy.get());
1562 m_geolocationClientProxy->setController(GeolocationController::from(m_fr ame.get())); 1581 m_geolocationClientProxy->setController(GeolocationController::from(m_fr ame.get()));
1563 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web MIDIClient() : 0)); 1582 provideMIDITo(*m_frame, MIDIClientProxy::create(m_client ? m_client->web MIDIClient() : 0));
1564 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create()); 1583 provideLocalFileSystemTo(*m_frame, LocalFileSystemClient::create());
1565 1584
1566 if (RuntimeEnabledFeatures::screenOrientationEnabled()) 1585 if (RuntimeEnabledFeatures::screenOrientationEnabled())
1567 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client ->webScreenOrientationClient() : 0); 1586 ScreenOrientationController::provideTo(*m_frame, m_client ? m_client ->webScreenOrientationClient() : 0);
1568 } 1587 }
1569 } 1588 }
1570 1589
1571 PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, F rameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) 1590 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::initializeCoreFrame(FrameH ost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fall backName)
1572 { 1591 {
1573 RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host , owner); 1592 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClie ntImpl, host, owner);
1574 setCoreFrame(frame); 1593 setCoreFrame(frame);
1575 frame->tree().setName(name, fallbackName); 1594 frame->tree().setName(name, fallbackName);
1576 // We must call init() after m_frame is assigned because it is referenced 1595 // We must call init() after m_frame is assigned because it is referenced
1577 // during init(). Note that this may dispatch JS events; the frame may be 1596 // during init(). Note that this may dispatch JS events; the frame may be
1578 // detached after init() returns. 1597 // detached after init() returns.
1579 frame->init(); 1598 frame->init();
1580 return frame; 1599 return frame;
1581 } 1600 }
1582 1601
1583 PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques t& request, HTMLFrameOwnerElement* ownerElement) 1602 PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra meLoadRequest& request, HTMLFrameOwnerElement* ownerElement)
1584 { 1603 {
1585 ASSERT(m_client); 1604 ASSERT(m_client);
1586 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, request.frameName())); 1605 WebLocalFrameImpl* webframeChild = toWebLocalFrameImpl(m_client->createChild Frame(this, request.frameName()));
1587 if (!webframeChild) 1606 if (!webframeChild)
1588 return nullptr; 1607 return nullptr;
1589 1608
1590 // FIXME: Using subResourceAttributeName as fallback is not a perfect 1609 // FIXME: Using subResourceAttributeName as fallback is not a perfect
1591 // solution. subResourceAttributeName returns just one attribute name. The 1610 // solution. subResourceAttributeName returns just one attribute name. The
1592 // element might not have the attribute, and there might be other attributes 1611 // element might not have the attribute, and there might be other attributes
1593 // which can identify the element. 1612 // which can identify the element.
1594 RefPtr<LocalFrame> child = webframeChild->initializeCoreFrame(frame()->host( ), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement->s ubResourceAttributeName())); 1613 RefPtrWillBeRawPtr<LocalFrame> child = webframeChild->initializeCoreFrame(fr ame()->host(), ownerElement, request.frameName(), ownerElement->getAttribute(own erElement->subResourceAttributeName()));
1595 // Initializing the core frame may cause the new child to be detached, since 1614 // Initializing the core frame may cause the new child to be detached, since
1596 // it may dispatch a load event in the parent. 1615 // it may dispatch a load event in the parent.
1597 if (!child->tree().parent()) 1616 if (!child->tree().parent())
1598 return nullptr; 1617 return nullptr;
1599 1618
1600 // If we're moving in the back/forward list, we might want to replace the co ntent 1619 // If we're moving in the back/forward list, we might want to replace the co ntent
1601 // of this child frame with whatever was there at that point. 1620 // of this child frame with whatever was there at that point.
1602 RefPtr<HistoryItem> childItem; 1621 RefPtr<HistoryItem> childItem;
1603 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished()) 1622 if (isBackForwardLoadType(frame()->loader().loadType()) && !frame()->documen t()->loadEventFinished())
1604 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem ForNewChildFrame(webframeChild)); 1623 childItem = PassRefPtr<HistoryItem>(webframeChild->client()->historyItem ForNewChildFrame(webframeChild));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 1891
1873 void WebLocalFrameImpl::invalidateAll() const 1892 void WebLocalFrameImpl::invalidateAll() const
1874 { 1893 {
1875 ASSERT(frame() && frame()->view()); 1894 ASSERT(frame() && frame()->view());
1876 FrameView* view = frame()->view(); 1895 FrameView* view = frame()->view();
1877 view->invalidateRect(view->frameRect()); 1896 view->invalidateRect(view->frameRect());
1878 invalidateScrollbar(); 1897 invalidateScrollbar();
1879 } 1898 }
1880 1899
1881 } // namespace blink 1900 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698