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

Side by Side Diff: Source/WebKit/chromium/src/WebPagePopupImpl.cpp

Issue 17640007: Refactoring: Simplify DocumentWriter by reorganizing its lifetime. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-landing after fixing ASAN failure on set-parent-src-synchronously.xhtml. Created 7 years, 5 months 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
« no previous file with comments | « Source/WebKit/chromium/src/WebHelperPluginImpl.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient) ; 209 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient) ;
210 frame->setView(FrameView::create(frame.get())); 210 frame->setView(FrameView::create(frame.get()));
211 frame->init(); 211 frame->init();
212 frame->view()->resize(m_popupClient->contentSize()); 212 frame->view()->resize(m_popupClient->contentSize());
213 frame->view()->setTransparent(false); 213 frame->view()->setTransparent(false);
214 214
215 DOMWindowPagePopup::install(frame->document()->domWindow(), m_popupClient); 215 DOMWindowPagePopup::install(frame->document()->domWindow(), m_popupClient);
216 216
217 DocumentWriter* writer = frame->loader()->activeDocumentLoader()->beginWriti ng("text/html", "UTF-8"); 217 DocumentWriter* writer = frame->loader()->activeDocumentLoader()->beginWriti ng("text/html", "UTF-8");
218 m_popupClient->writeDocument(*writer); 218 m_popupClient->writeDocument(*writer);
219 writer->end(); 219 frame->loader()->activeDocumentLoader()->endWriting(writer);
220 return true; 220 return true;
221 } 221 }
222 222
223 void WebPagePopupImpl::destroyPage() 223 void WebPagePopupImpl::destroyPage()
224 { 224 {
225 if (!m_page) 225 if (!m_page)
226 return; 226 return;
227 227
228 if (m_page->mainFrame()) 228 if (m_page->mainFrame())
229 m_page->mainFrame()->loader()->frameDetached(); 229 m_page->mainFrame()->loader()->frameDetached();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // A WebPagePopupImpl instance usually has two references. 345 // A WebPagePopupImpl instance usually has two references.
346 // - One owned by the instance itself. It represents the visible widget. 346 // - One owned by the instance itself. It represents the visible widget.
347 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 347 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
348 // WebPagePopupImpl to close. 348 // WebPagePopupImpl to close.
349 // We need them because the closing operation is asynchronous and the widget 349 // We need them because the closing operation is asynchronous and the widget
350 // can be closed while the WebViewImpl is unaware of it. 350 // can be closed while the WebViewImpl is unaware of it.
351 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 351 return adoptRef(new WebPagePopupImpl(client)).leakRef();
352 } 352 }
353 353
354 } // namespace WebKit 354 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebHelperPluginImpl.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698