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