| 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 // addClient() will call notifyFinished() if the load is complete. Callers | 43 ASSERT(!isReady()); |
| 44 // who do not expect to be re-entered from this call should not call | |
| 45 // watchForLoad for a PendingScript which isReady. | |
| 46 if (m_streamer) { | 44 if (m_streamer) { |
| 47 m_streamer->addClient(client); | 45 m_streamer->addClient(client); |
| 48 } else { | 46 } 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. |
| 49 resource()->addClient(client); | 50 resource()->addClient(client); |
| 50 } | 51 } |
| 51 m_watchingForLoad = true; | 52 m_watchingForLoad = true; |
| 52 } | 53 } |
| 53 | 54 |
| 54 void PendingScript::stopWatchingForLoad(ScriptResourceClient* client) | 55 void PendingScript::stopWatchingForLoad(ScriptResourceClient* client) |
| 55 { | 56 { |
| 56 if (!m_watchingForLoad) | 57 if (!m_watchingForLoad) |
| 57 return; | 58 return; |
| 58 ASSERT(resource()); | 59 ASSERT(resource()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool PendingScript::isReady() const | 114 bool PendingScript::isReady() const |
| 114 { | 115 { |
| 115 if (resource() && !resource()->isLoaded()) | 116 if (resource() && !resource()->isLoaded()) |
| 116 return false; | 117 return false; |
| 117 if (m_streamer && !m_streamer->isFinished()) | 118 if (m_streamer && !m_streamer->isFinished()) |
| 118 return false; | 119 return false; |
| 119 return true; | 120 return true; |
| 120 } | 121 } |
| 121 | 122 |
| 122 } | 123 } |
| OLD | NEW |