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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return frame()->tree().name(); | 538 return frame()->tree().name(); |
539 } | 539 } |
540 | 540 |
541 void WebFrameImpl::setName(const WebString& name) | 541 void WebFrameImpl::setName(const WebString& name) |
542 { | 542 { |
543 frame()->tree().setName(name); | 543 frame()->tree().setName(name); |
544 } | 544 } |
545 | 545 |
546 long long WebFrameImpl::embedderIdentifier() const | 546 long long WebFrameImpl::embedderIdentifier() const |
547 { | 547 { |
548 return m_embedderIdentifier; | 548 return m_frameInit->frameID(); |
549 } | 549 } |
550 | 550 |
551 WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypesMask) const | 551 WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypesMask) const |
552 { | 552 { |
553 // The URL to the icon may be in the header. As such, only | 553 // The URL to the icon may be in the header. As such, only |
554 // ask the loader for the icon if it's finished loading. | 554 // ask the loader for the icon if it's finished loading. |
555 if (frame()->loader().state() == FrameStateComplete) | 555 if (frame()->loader().state() == FrameStateComplete) |
556 return frame()->loader().icon()->urlsForTypes(iconTypesMask); | 556 return frame()->loader().icon()->urlsForTypes(iconTypesMask); |
557 return WebVector<WebIconURL>(); | 557 return WebVector<WebIconURL>(); |
558 } | 558 } |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 return WebFrameImpl::create(client, generateEmbedderIdentifier()); | 2089 return WebFrameImpl::create(client, generateEmbedderIdentifier()); |
2090 } | 2090 } |
2091 | 2091 |
2092 WebFrameImpl* WebFrameImpl::create(WebFrameClient* client, long long embedderIde
ntifier) | 2092 WebFrameImpl* WebFrameImpl::create(WebFrameClient* client, long long embedderIde
ntifier) |
2093 { | 2093 { |
2094 return adoptRef(new WebFrameImpl(client, embedderIdentifier)).leakRef(); | 2094 return adoptRef(new WebFrameImpl(client, embedderIdentifier)).leakRef(); |
2095 } | 2095 } |
2096 | 2096 |
2097 WebFrameImpl::WebFrameImpl(WebFrameClient* client, long long embedderIdentifier) | 2097 WebFrameImpl::WebFrameImpl(WebFrameClient* client, long long embedderIdentifier) |
2098 : FrameDestructionObserver(0) | 2098 : FrameDestructionObserver(0) |
2099 , m_frameLoaderClient(this) | 2099 , m_frameInit(WebFrameInit::create(this, embedderIdentifier)) |
2100 , m_client(client) | 2100 , m_client(client) |
2101 , m_currentActiveMatchFrame(0) | 2101 , m_currentActiveMatchFrame(0) |
2102 , m_activeMatchIndexInCurrentFrame(-1) | 2102 , m_activeMatchIndexInCurrentFrame(-1) |
2103 , m_locatingActiveRect(false) | 2103 , m_locatingActiveRect(false) |
2104 , m_resumeScopingFromRange(0) | 2104 , m_resumeScopingFromRange(0) |
2105 , m_lastMatchCount(-1) | 2105 , m_lastMatchCount(-1) |
2106 , m_totalMatchCount(-1) | 2106 , m_totalMatchCount(-1) |
2107 , m_framesScopingCount(-1) | 2107 , m_framesScopingCount(-1) |
2108 , m_findRequestIdentifier(-1) | 2108 , m_findRequestIdentifier(-1) |
2109 , m_scopingInProgress(false) | 2109 , m_scopingInProgress(false) |
2110 , m_lastFindRequestCompletedWithNoMatches(false) | 2110 , m_lastFindRequestCompletedWithNoMatches(false) |
2111 , m_nextInvalidateAfter(0) | 2111 , m_nextInvalidateAfter(0) |
2112 , m_findMatchMarkersVersion(0) | 2112 , m_findMatchMarkersVersion(0) |
2113 , m_findMatchRectsAreValid(false) | 2113 , m_findMatchRectsAreValid(false) |
2114 , m_embedderIdentifier(embedderIdentifier) | |
2115 , m_inSameDocumentHistoryLoad(false) | 2114 , m_inSameDocumentHistoryLoad(false) |
2116 , m_inputEventsScaleFactorForEmulation(1) | 2115 , m_inputEventsScaleFactorForEmulation(1) |
2117 { | 2116 { |
2118 WebKit::Platform::current()->incrementStatsCounter(webFrameActiveCount); | 2117 WebKit::Platform::current()->incrementStatsCounter(webFrameActiveCount); |
2119 frameCount++; | 2118 frameCount++; |
2120 } | 2119 } |
2121 | 2120 |
2122 WebFrameImpl::~WebFrameImpl() | 2121 WebFrameImpl::~WebFrameImpl() |
2123 { | 2122 { |
2124 WebKit::Platform::current()->decrementStatsCounter(webFrameActiveCount); | 2123 WebKit::Platform::current()->decrementStatsCounter(webFrameActiveCount); |
2125 frameCount--; | 2124 frameCount--; |
2126 | 2125 |
2127 cancelPendingScopingEffort(); | 2126 cancelPendingScopingEffort(); |
2128 } | 2127 } |
2129 | 2128 |
2130 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) | 2129 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) |
2131 { | 2130 { |
2132 ASSERT(frame); | 2131 ASSERT(frame); |
2133 observeFrame(frame); | 2132 observeFrame(frame); |
2134 } | 2133 } |
2135 | 2134 |
2136 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) | 2135 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) |
2137 { | 2136 { |
2138 RefPtr<Frame> mainFrame = Frame::create(page, 0, &m_frameLoaderClient); | 2137 m_frameInit->setPage(page); |
| 2138 RefPtr<Frame> mainFrame = Frame::create(m_frameInit); |
2139 setWebCoreFrame(mainFrame.get()); | 2139 setWebCoreFrame(mainFrame.get()); |
2140 | 2140 |
2141 // Add reference on behalf of FrameLoader. See comments in | 2141 // Add reference on behalf of FrameLoader. See comments in |
2142 // WebFrameLoaderClient::frameLoaderDestroyed for more info. | 2142 // WebFrameLoaderClient::frameLoaderDestroyed for more info. |
2143 ref(); | 2143 ref(); |
2144 | 2144 |
2145 // We must call init() after m_frame is assigned because it is referenced | 2145 // We must call init() after m_frame is assigned because it is referenced |
2146 // during init(). | 2146 // during init(). |
2147 frame()->init(); | 2147 frame()->init(); |
2148 } | 2148 } |
(...skipping 17 matching lines...) Expand all Loading... |
2166 mustCallDidCreateFrame = true; | 2166 mustCallDidCreateFrame = true; |
2167 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client)); | 2167 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client)); |
2168 webframe = webframeLifetimeHack.get(); | 2168 webframe = webframeLifetimeHack.get(); |
2169 } | 2169 } |
2170 | 2170 |
2171 // Add an extra ref on behalf of the page/FrameLoader, which references the | 2171 // Add an extra ref on behalf of the page/FrameLoader, which references the |
2172 // WebFrame via the FrameLoaderClient interface. See the comment at the top | 2172 // WebFrame via the FrameLoaderClient interface. See the comment at the top |
2173 // of this file for more info. | 2173 // of this file for more info. |
2174 webframe->ref(); | 2174 webframe->ref(); |
2175 | 2175 |
2176 RefPtr<Frame> childFrame = Frame::create(frame()->page(), ownerElement, &web
frame->m_frameLoaderClient); | 2176 webframe->m_frameInit->setPage(frame()->page()); |
| 2177 webframe->m_frameInit->setOwnerElement(ownerElement); |
| 2178 RefPtr<Frame> childFrame = Frame::create(webframe->m_frameInit); |
2177 webframe->setWebCoreFrame(childFrame.get()); | 2179 webframe->setWebCoreFrame(childFrame.get()); |
2178 | 2180 |
2179 childFrame->tree().setName(request.frameName()); | 2181 childFrame->tree().setName(request.frameName()); |
2180 | 2182 |
2181 frame()->tree().appendChild(childFrame); | 2183 frame()->tree().appendChild(childFrame); |
2182 | 2184 |
2183 // FIXME: Remove once all embedders return non-null from createChildFrame(). | 2185 // FIXME: Remove once all embedders return non-null from createChildFrame(). |
2184 if (mustCallDidCreateFrame) | 2186 if (mustCallDidCreateFrame) |
2185 m_client->didCreateFrame(this, webframe); | 2187 m_client->didCreateFrame(this, webframe); |
2186 | 2188 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 | 2522 |
2521 // There is a possibility that the frame being detached was the only | 2523 // There is a possibility that the frame being detached was the only |
2522 // pending one. We need to make sure final replies can be sent. | 2524 // pending one. We need to make sure final replies can be sent. |
2523 flushCurrentScopingEffort(m_findRequestIdentifier); | 2525 flushCurrentScopingEffort(m_findRequestIdentifier); |
2524 | 2526 |
2525 cancelPendingScopingEffort(); | 2527 cancelPendingScopingEffort(); |
2526 } | 2528 } |
2527 } | 2529 } |
2528 | 2530 |
2529 } // namespace WebKit | 2531 } // namespace WebKit |
OLD | NEW |