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

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

Issue 669503003: Revert of 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
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.h ('k') | Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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
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 }
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.h ('k') | Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698