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

Side by Side Diff: Source/core/workers/WorkerScriptLoader.h

Issue 1213443006: Invoke WorkerScriptLoader's m_finishedCallback callback safely. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review #3 Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class CORE_EXPORT WorkerScriptLoader final : public ThreadableLoaderClient { 50 class CORE_EXPORT WorkerScriptLoader final : public ThreadableLoaderClient {
51 WTF_MAKE_FAST_ALLOCATED(WorkerScriptLoader); 51 WTF_MAKE_FAST_ALLOCATED(WorkerScriptLoader);
52 public: 52 public:
53 WorkerScriptLoader(); 53 WorkerScriptLoader();
54 ~WorkerScriptLoader() override; 54 ~WorkerScriptLoader() override;
55 55
56 void loadSynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPol icy); 56 void loadSynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPol icy);
57 // TODO: finishedCallback is not currently guaranteed to be invoked if used 57 // TODO: finishedCallback is not currently guaranteed to be invoked if used
58 // from worker context and the worker shuts down in the middle of an 58 // from worker context and the worker shuts down in the middle of an
59 // operation. This will cause leaks when we support nested workers. 59 // operation. This will cause leaks when we support nested workers.
60 // Note that callbacks could be invoked before loadAsynchronously() returns.
60 void loadAsynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPo licy, PassOwnPtr<Closure> responseCallback, PassOwnPtr<Closure> finishedCallback ); 61 void loadAsynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPo licy, PassOwnPtr<Closure> responseCallback, PassOwnPtr<Closure> finishedCallback );
61 62
62 void notifyError(); 63 void notifyError();
63 64
64 // This will immediately lead to notifyFinished() if loadAsynchronously 65 // This will immediately lead to notifyFinished() if loadAsynchronously
65 // is in progress. 66 // is in progress.
66 void cancel(); 67 void cancel();
67 68
68 String script(); 69 String script();
69 const KURL& url() const { return m_url; } 70 const KURL& url() const { return m_url; }
(...skipping 30 matching lines...) Expand all
100 101
101 RefPtr<ThreadableLoader> m_threadableLoader; 102 RefPtr<ThreadableLoader> m_threadableLoader;
102 String m_responseEncoding; 103 String m_responseEncoding;
103 OwnPtr<TextResourceDecoder> m_decoder; 104 OwnPtr<TextResourceDecoder> m_decoder;
104 StringBuilder m_script; 105 StringBuilder m_script;
105 KURL m_url; 106 KURL m_url;
106 KURL m_responseURL; 107 KURL m_responseURL;
107 bool m_failed; 108 bool m_failed;
108 unsigned long m_identifier; 109 unsigned long m_identifier;
109 long long m_appCacheID; 110 long long m_appCacheID;
110 bool m_finishing;
111 OwnPtr<Vector<char>> m_cachedMetadata; 111 OwnPtr<Vector<char>> m_cachedMetadata;
112 WebURLRequest::RequestContext m_requestContext; 112 WebURLRequest::RequestContext m_requestContext;
113 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy; 113 RefPtr<ContentSecurityPolicy> m_contentSecurityPolicy;
114 }; 114 };
115 115
116 } // namespace blink 116 } // namespace blink
117 117
118 #endif // WorkerScriptLoader_h 118 #endif // WorkerScriptLoader_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/workers/WorkerScriptLoader.cpp » ('j') | Source/core/workers/WorkerScriptLoader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698