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