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