Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: Source/web/WebFrameImpl.cpp

Issue 115293005: Add a layer of indirection between Frame and Page (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 } 2123 }
2124 2124
2125 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) 2125 void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame)
2126 { 2126 {
2127 ASSERT(frame); 2127 ASSERT(frame);
2128 observeFrame(frame); 2128 observeFrame(frame);
2129 } 2129 }
2130 2130
2131 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) 2131 void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page)
2132 { 2132 {
2133 m_frameInit->setPage(page); 2133 // FIXME: This whole function can go away once ownerhip of WebFrame is rever sed.
2134 // Page should create it's main WebFrame, not have FrameLoader do it only
2135 // to have to mark the frame as main later.
2136 m_frameInit->setFrameHost(&page->frameHost());
2134 RefPtr<Frame> mainFrame = Frame::create(m_frameInit); 2137 RefPtr<Frame> mainFrame = Frame::create(m_frameInit);
2135 setWebCoreFrame(mainFrame.get()); 2138 setWebCoreFrame(mainFrame.get());
2136 2139
2137 // Add reference on behalf of FrameLoader. See comments in 2140 // Add reference on behalf of FrameLoader. See comments in
2138 // WebFrameLoaderClient::frameLoaderDestroyed for more info. 2141 // WebFrameLoaderClient::frameLoaderDestroyed for more info.
2139 ref(); 2142 ref();
2140 2143
2141 // We must call init() after m_frame is assigned because it is referenced 2144 // We must call init() after m_frame is assigned because it is referenced
2142 // during init(). 2145 // during init().
2143 frame()->init(); 2146 frame()->init();
(...skipping 18 matching lines...) Expand all
2162 mustCallDidCreateFrame = true; 2165 mustCallDidCreateFrame = true;
2163 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client)); 2166 webframeLifetimeHack = adoptRef(WebFrameImpl::create(m_client));
2164 webframe = webframeLifetimeHack.get(); 2167 webframe = webframeLifetimeHack.get();
2165 } 2168 }
2166 2169
2167 // Add an extra ref on behalf of the page/FrameLoader, which references the 2170 // Add an extra ref on behalf of the page/FrameLoader, which references the
2168 // WebFrame via the FrameLoaderClient interface. See the comment at the top 2171 // WebFrame via the FrameLoaderClient interface. See the comment at the top
2169 // of this file for more info. 2172 // of this file for more info.
2170 webframe->ref(); 2173 webframe->ref();
2171 2174
2172 webframe->m_frameInit->setPage(frame()->page()); 2175 webframe->m_frameInit->setFrameHost(frame()->host());
2173 webframe->m_frameInit->setOwnerElement(ownerElement); 2176 webframe->m_frameInit->setOwnerElement(ownerElement);
2174 RefPtr<Frame> childFrame = Frame::create(webframe->m_frameInit); 2177 RefPtr<Frame> childFrame = Frame::create(webframe->m_frameInit);
2175 webframe->setWebCoreFrame(childFrame.get()); 2178 webframe->setWebCoreFrame(childFrame.get());
2176 2179
2177 childFrame->tree().setName(request.frameName()); 2180 childFrame->tree().setName(request.frameName());
2178 2181
2179 frame()->tree().appendChild(childFrame); 2182 frame()->tree().appendChild(childFrame);
2180 2183
2181 // FIXME: Remove once all embedders return non-null from createChildFrame(). 2184 // FIXME: Remove once all embedders return non-null from createChildFrame().
2182 if (mustCallDidCreateFrame) 2185 if (mustCallDidCreateFrame)
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 ScriptValue result = frame()->script().executeScriptInMainWorldAndReturnValu e(ScriptSourceCode(script)); 2503 ScriptValue result = frame()->script().executeScriptInMainWorldAndReturnValu e(ScriptSourceCode(script));
2501 2504
2502 String scriptResult; 2505 String scriptResult;
2503 if (!result.getString(scriptResult)) 2506 if (!result.getString(scriptResult))
2504 return; 2507 return;
2505 2508
2506 if (!frame()->navigationScheduler().locationChangePending()) 2509 if (!frame()->navigationScheduler().locationChangePending())
2507 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume nt.get()); 2510 frame()->document()->loader()->replaceDocument(scriptResult, ownerDocume nt.get());
2508 } 2511 }
2509 2512
2510 void WebFrameImpl::willDetachPage() 2513 void WebFrameImpl::willDetachFrameHost()
2511 { 2514 {
2515 // FIXME: This should never be called if the Frame has already been detached ?
2512 if (!frame() || !frame()->page()) 2516 if (!frame() || !frame()->page())
2513 return; 2517 return;
2514 2518
2515 // Do not expect string scoping results from any frames that got detached 2519 // Do not expect string scoping results from any frames that got detached
2516 // in the middle of the operation. 2520 // in the middle of the operation.
2517 if (m_scopingInProgress) { 2521 if (m_scopingInProgress) {
2518 2522
2519 // 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
2520 // 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.
2521 flushCurrentScopingEffort(m_findRequestIdentifier); 2525 flushCurrentScopingEffort(m_findRequestIdentifier);
2522 2526
2523 cancelPendingScopingEffort(); 2527 cancelPendingScopingEffort();
2524 } 2528 }
2525 } 2529 }
2526 2530
2527 } // namespace blink 2531 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698