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

Side by Side Diff: Source/WebKit/chromium/src/WebHelperPluginImpl.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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // settings and other decisions can be made based on the correct origin. 66 // settings and other decisions can be made based on the correct origin.
67 const WebURL& url = hostDocument.url(); 67 const WebURL& url = hostDocument.url();
68 68
69 DocumentWriter* writer = loader->beginWriting("text/html", "UTF-8", url); 69 DocumentWriter* writer = loader->beginWriting("text/html", "UTF-8", url);
70 70
71 addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", wri ter); 71 addLiteral("<!DOCTYPE html><head><meta charset='UTF-8'></head><body>\n", wri ter);
72 String objectTag = "<object type=\"" + pluginType + "\"></object>"; 72 String objectTag = "<object type=\"" + pluginType + "\"></object>";
73 addString(objectTag, writer); 73 addString(objectTag, writer);
74 addLiteral("</body>\n", writer); 74 addLiteral("</body>\n", writer);
75 75
76 writer->end(); 76 loader->endWriting(writer);
77 } 77 }
78 78
79 class HelperPluginChromeClient : public EmptyChromeClient { 79 class HelperPluginChromeClient : public EmptyChromeClient {
80 WTF_MAKE_NONCOPYABLE(HelperPluginChromeClient); 80 WTF_MAKE_NONCOPYABLE(HelperPluginChromeClient);
81 WTF_MAKE_FAST_ALLOCATED; 81 WTF_MAKE_FAST_ALLOCATED;
82 82
83 public: 83 public:
84 explicit HelperPluginChromeClient(WebHelperPluginImpl* widget) 84 explicit HelperPluginChromeClient(WebHelperPluginImpl* widget)
85 : m_widget(widget) 85 : m_widget(widget)
86 { 86 {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // A WebHelperPluginImpl instance usually has two references. 244 // A WebHelperPluginImpl instance usually has two references.
245 // - One owned by the instance itself. It represents the visible widget. 245 // - One owned by the instance itself. It represents the visible widget.
246 // - One owned by the hosting element. It's released when the hosting 246 // - One owned by the hosting element. It's released when the hosting
247 // element asks the WebHelperPluginImpl to close. 247 // element asks the WebHelperPluginImpl to close.
248 // We need them because the closing operation is asynchronous and the widget 248 // We need them because the closing operation is asynchronous and the widget
249 // can be closed while the hosting element is unaware of it. 249 // can be closed while the hosting element is unaware of it.
250 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); 250 return adoptRef(new WebHelperPluginImpl(client)).leakRef();
251 } 251 }
252 252
253 } // namespace WebKit 253 } // namespace WebKit
OLDNEW
« no previous file with comments | « LayoutTests/mhtml/base_url-expected.txt ('k') | Source/WebKit/chromium/src/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698