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