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

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

Powered by Google App Engine
This is Rietveld 408576698