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

Side by Side Diff: Source/core/dom/PendingScript.cpp

Issue 656113002: Refactor Script(Loader|Runner): don't access Resources all over the place... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 6 years, 2 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
OLDNEW
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
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
haraken 2014/10/15 15:09:41 Can we keep this ASSERT? The comment implies that
marja 2014/10/16 15:19:03 Ditto
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698