| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // being added as a client later & now being notified. Fail early. | 85 // being added as a client later & now being notified. Fail early. |
| 86 if (resource->loadFailedOrCanceled() || response.httpStatusCode() >= 400) { | 86 if (resource->loadFailedOrCanceled() || response.httpStatusCode() >= 400) { |
| 87 setState(StateError); | 87 setState(StateError); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 setState(startWritingAndParsing(response)); | 90 setState(startWritingAndParsing(response)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void HTMLImportLoader::dataReceived(Resource*, const char* data, int length) | 93 void HTMLImportLoader::dataReceived(Resource*, const char* data, int length) |
| 94 { | 94 { |
| 95 RefPtr<DocumentWriter> protectingWriter(m_writer); | 95 RefPtrWillBeRawPtr<DocumentWriter> protectingWriter(m_writer.get()); |
| 96 m_writer->addData(data, length); | 96 m_writer->addData(data, length); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void HTMLImportLoader::notifyFinished(Resource* resource) | 99 void HTMLImportLoader::notifyFinished(Resource* resource) |
| 100 { | 100 { |
| 101 // The writer instance indicates that a part of the document can be already
loaded. | 101 // The writer instance indicates that a part of the document can be already
loaded. |
| 102 // We don't take such a case as an error because the partially-loaded docume
nt has been visible from script at this point. | 102 // We don't take such a case as an error because the partially-loaded docume
nt has been visible from script at this point. |
| 103 if (resource->loadFailedOrCanceled() && !m_writer) { | 103 if (resource->loadFailedOrCanceled() && !m_writer) { |
| 104 setState(StateError); | 104 setState(StateError); |
| 105 return; | 105 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 void HTMLImportLoader::setState(State state) | 137 void HTMLImportLoader::setState(State state) |
| 138 { | 138 { |
| 139 if (m_state == state) | 139 if (m_state == state) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 m_state = state; | 142 m_state = state; |
| 143 | 143 |
| 144 if (m_state == StateParsed || m_state == StateError || m_state == StateWritt
en) { | 144 if (m_state == StateParsed || m_state == StateError || m_state == StateWritt
en) { |
| 145 if (RefPtr<DocumentWriter> writer = m_writer.release()) | 145 if (RefPtrWillBeRawPtr<DocumentWriter> writer = m_writer.release()) |
| 146 writer->end(); | 146 writer->end(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Since DocumentWriter::end() can let setState() reenter, we shouldn't refe
r to m_state here. | 149 // Since DocumentWriter::end() can let setState() reenter, we shouldn't refe
r to m_state here. |
| 150 if (state == StateLoaded || state == StateError) | 150 if (state == StateLoaded || state == StateError) |
| 151 didFinishLoading(); | 151 didFinishLoading(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void HTMLImportLoader::didFinishParsing() | 154 void HTMLImportLoader::didFinishParsing() |
| 155 { | 155 { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return m_microtaskQueue; | 215 return m_microtaskQueue; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void HTMLImportLoader::trace(Visitor* visitor) | 218 void HTMLImportLoader::trace(Visitor* visitor) |
| 219 { | 219 { |
| 220 visitor->trace(m_controller); | 220 visitor->trace(m_controller); |
| 221 #if ENABLE(OILPAN) | 221 #if ENABLE(OILPAN) |
| 222 visitor->trace(m_imports); | 222 visitor->trace(m_imports); |
| 223 #endif | 223 #endif |
| 224 visitor->trace(m_document); | 224 visitor->trace(m_document); |
| 225 visitor->trace(m_writer); |
| 225 visitor->trace(m_microtaskQueue); | 226 visitor->trace(m_microtaskQueue); |
| 226 } | 227 } |
| 227 | 228 |
| 228 } // namespace WebCore | 229 } // namespace WebCore |
| OLD | NEW |