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

Side by Side Diff: Source/core/loader/ThreadableLoader.h

Issue 1304043006: Make classes and structures in core/loader fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ThreadableLoader_h 31 #ifndef ThreadableLoader_h
32 #define ThreadableLoader_h 32 #define ThreadableLoader_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/fetch/ResourceLoaderOptions.h" 35 #include "core/fetch/ResourceLoaderOptions.h"
36 #include "platform/CrossThreadCopier.h" 36 #include "platform/CrossThreadCopier.h"
37 #include "wtf/Allocator.h"
37 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
38 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 class ResourceRequest; 45 class ResourceRequest;
45 class ExecutionContext; 46 class ExecutionContext;
46 class ThreadableLoaderClient; 47 class ThreadableLoaderClient;
47 48
48 enum CrossOriginRequestPolicy { 49 enum CrossOriginRequestPolicy {
49 DenyCrossOriginRequests, 50 DenyCrossOriginRequests,
50 UseAccessControl, 51 UseAccessControl,
51 AllowCrossOriginRequests 52 AllowCrossOriginRequests
52 }; 53 };
53 54
54 enum PreflightPolicy { 55 enum PreflightPolicy {
55 ConsiderPreflight, 56 ConsiderPreflight,
56 ForcePreflight, 57 ForcePreflight,
57 PreventPreflight 58 PreventPreflight
58 }; 59 };
59 60
60 enum ContentSecurityPolicyEnforcement { 61 enum ContentSecurityPolicyEnforcement {
61 EnforceConnectSrcDirective, 62 EnforceConnectSrcDirective,
62 DoNotEnforceContentSecurityPolicy, 63 DoNotEnforceContentSecurityPolicy,
63 }; 64 };
64 65
65 struct ThreadableLoaderOptions { 66 struct ThreadableLoaderOptions {
67 DISALLOW_ALLOCATION();
66 ThreadableLoaderOptions() 68 ThreadableLoaderOptions()
67 : preflightPolicy(ConsiderPreflight) 69 : preflightPolicy(ConsiderPreflight)
68 , crossOriginRequestPolicy(DenyCrossOriginRequests) 70 , crossOriginRequestPolicy(DenyCrossOriginRequests)
69 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective) 71 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective)
70 , timeoutMilliseconds(0) { } 72 , timeoutMilliseconds(0) { }
71 73
72 // When adding members, CrossThreadThreadableLoaderOptionsData should 74 // When adding members, CrossThreadThreadableLoaderOptionsData should
73 // be updated. 75 // be updated.
74 PreflightPolicy preflightPolicy; // If AccessControl is used, how to determi ne if a preflight is needed. 76 PreflightPolicy preflightPolicy; // If AccessControl is used, how to determi ne if a preflight is needed.
75 CrossOriginRequestPolicy crossOriginRequestPolicy; 77 CrossOriginRequestPolicy crossOriginRequestPolicy;
76 AtomicString initiator; 78 AtomicString initiator;
77 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; 79 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement;
78 unsigned long timeoutMilliseconds; 80 unsigned long timeoutMilliseconds;
79 }; 81 };
80 82
81 // Encode AtomicString as String to cross threads. 83 // Encode AtomicString as String to cross threads.
82 struct CrossThreadThreadableLoaderOptionsData { 84 struct CrossThreadThreadableLoaderOptionsData {
85 STACK_ALLOCATED();
83 explicit CrossThreadThreadableLoaderOptionsData(const ThreadableLoaderOption s& options) 86 explicit CrossThreadThreadableLoaderOptionsData(const ThreadableLoaderOption s& options)
84 : preflightPolicy(options.preflightPolicy) 87 : preflightPolicy(options.preflightPolicy)
85 , crossOriginRequestPolicy(options.crossOriginRequestPolicy) 88 , crossOriginRequestPolicy(options.crossOriginRequestPolicy)
86 , initiator(options.initiator.string().isolatedCopy()) 89 , initiator(options.initiator.string().isolatedCopy())
87 , contentSecurityPolicyEnforcement(options.contentSecurityPolicyEnforcem ent) 90 , contentSecurityPolicyEnforcement(options.contentSecurityPolicyEnforcem ent)
88 , timeoutMilliseconds(options.timeoutMilliseconds) { } 91 , timeoutMilliseconds(options.timeoutMilliseconds) { }
89 92
90 operator ThreadableLoaderOptions() const 93 operator ThreadableLoaderOptions() const
91 { 94 {
92 ThreadableLoaderOptions options; 95 ThreadableLoaderOptions options;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 141
139 virtual ~ThreadableLoader() { } 142 virtual ~ThreadableLoader() { }
140 143
141 protected: 144 protected:
142 ThreadableLoader() { } 145 ThreadableLoader() { }
143 }; 146 };
144 147
145 } // namespace blink 148 } // namespace blink
146 149
147 #endif // ThreadableLoader_h 150 #endif // ThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698