| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 PendingScript::~PendingScript() | 36 PendingScript::~PendingScript() |
| 37 { | 37 { |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PendingScript::watchForLoad(ScriptResourceClient* client) | 40 void PendingScript::watchForLoad(ScriptResourceClient* client) |
| 41 { | 41 { |
| 42 ASSERT(!m_watchingForLoad); | 42 ASSERT(!m_watchingForLoad); |
| 43 ASSERT(!isReady()); | 43 // addClient() will call notifyFinished() if the load is complete. Callers |
| 44 // who do not expect to be re-entered from this call should not call |
| 45 // watchForLoad for a PendingScript which isReady. |
| 44 if (m_streamer) { | 46 if (m_streamer) { |
| 45 m_streamer->addClient(client); | 47 m_streamer->addClient(client); |
| 46 } else { | 48 } else { |
| 47 // addClient() will call notifyFinished() if the load is | |
| 48 // complete. Callers do not expect to be re-entered from this call, so | |
| 49 // they should not become a client of an already-loaded Resource. | |
| 50 resource()->addClient(client); | 49 resource()->addClient(client); |
| 51 } | 50 } |
| 52 m_watchingForLoad = true; | 51 m_watchingForLoad = true; |
| 53 } | 52 } |
| 54 | 53 |
| 55 void PendingScript::stopWatchingForLoad(ScriptResourceClient* client) | 54 void PendingScript::stopWatchingForLoad(ScriptResourceClient* client) |
| 56 { | 55 { |
| 57 if (!m_watchingForLoad) | 56 if (!m_watchingForLoad) |
| 58 return; | 57 return; |
| 59 ASSERT(resource()); | 58 ASSERT(resource()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool PendingScript::isReady() const | 113 bool PendingScript::isReady() const |
| 115 { | 114 { |
| 116 if (resource() && !resource()->isLoaded()) | 115 if (resource() && !resource()->isLoaded()) |
| 117 return false; | 116 return false; |
| 118 if (m_streamer && !m_streamer->isFinished()) | 117 if (m_streamer && !m_streamer->isFinished()) |
| 119 return false; | 118 return false; |
| 120 return true; | 119 return true; |
| 121 } | 120 } |
| 122 | 121 |
| 123 } | 122 } |
| OLD | NEW |