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

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

Issue 301243015: Refactor ThreadableLoaderOptions for readability (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ConsiderPreflight, 55 ConsiderPreflight,
56 ForcePreflight, 56 ForcePreflight,
57 PreventPreflight 57 PreventPreflight
58 }; 58 };
59 59
60 enum ContentSecurityPolicyEnforcement { 60 enum ContentSecurityPolicyEnforcement {
61 EnforceConnectSrcDirective, 61 EnforceConnectSrcDirective,
62 DoNotEnforceContentSecurityPolicy, 62 DoNotEnforceContentSecurityPolicy,
63 }; 63 };
64 64
65 struct ThreadableLoaderOptions : public ResourceLoaderOptions { 65 struct ThreadableLoaderOptions {
66 ThreadableLoaderOptions() 66 ThreadableLoaderOptions()
67 : preflightPolicy(ConsiderPreflight) 67 : preflightPolicy(ConsiderPreflight)
68 , crossOriginRequestPolicy(DenyCrossOriginRequests) 68 , crossOriginRequestPolicy(DenyCrossOriginRequests)
69 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective) 69 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective)
70 , timeoutMilliseconds(0) { } 70 , timeoutMilliseconds(0) { }
71 71
72 PreflightPolicy preflightPolicy; // If AccessControl is used, how to det ermine if a preflight is needed. 72 PreflightPolicy preflightPolicy; // If AccessControl is used, how to det ermine if a preflight is needed.
73 CrossOriginRequestPolicy crossOriginRequestPolicy; 73 CrossOriginRequestPolicy crossOriginRequestPolicy;
74 AtomicString initiator; 74 AtomicString initiator;
75 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; 75 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement;
76 unsigned long timeoutMilliseconds; 76 unsigned long timeoutMilliseconds;
77 }; 77 };
78 78
79 // Useful for doing loader operations from any thread (not threadsafe, 79 // Useful for doing loader operations from any thread (not threadsafe,
80 // just able to run on threads other than the main thread). 80 // just able to run on threads other than the main thread).
81 class ThreadableLoader : public RefCounted<ThreadableLoader> { 81 class ThreadableLoader : public RefCounted<ThreadableLoader> {
82 WTF_MAKE_NONCOPYABLE(ThreadableLoader); 82 WTF_MAKE_NONCOPYABLE(ThreadableLoader);
83 public: 83 public:
84 static void loadResourceSynchronously(ExecutionContext&, const ResourceR equest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); 84 // ThreadableLoaderOptions argument configures this ThreadableLoader's
85 static PassRefPtr<ThreadableLoader> create(ExecutionContext&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); 85 // behavior.
86 //
87 // ResourceLoaderOptions argument will be passed to the FetchRequest
88 // that this ThreadableLoader creates. It can be altered e.g. when
89 // redirect happens.
90 static void loadResourceSynchronously(ExecutionContext&, const ResourceR equest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const Resource LoaderOptions&);
91 static PassRefPtr<ThreadableLoader> create(ExecutionContext&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res ourceLoaderOptions&);
86 92
87 virtual void cancel() = 0; 93 virtual void cancel() = 0;
88 94
89 virtual ~ThreadableLoader() { } 95 virtual ~ThreadableLoader() { }
90 96
91 protected: 97 protected:
92 ThreadableLoader() { } 98 ThreadableLoader() { }
93 }; 99 };
94 100
95 } // namespace WebCore 101 } // namespace WebCore
96 102
97 #endif // ThreadableLoader_h 103 #endif // ThreadableLoader_h
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentThreadableLoader.cpp ('k') | Source/core/loader/ThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698