| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |