| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 enum ContentSecurityPolicyEnforcement { | 62 enum ContentSecurityPolicyEnforcement { |
| 63 EnforceConnectSrcDirective, | 63 EnforceConnectSrcDirective, |
| 64 DoNotEnforceContentSecurityPolicy, | 64 DoNotEnforceContentSecurityPolicy, |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 struct ThreadableLoaderOptions : public ResourceLoaderOptions { | 67 struct ThreadableLoaderOptions : public ResourceLoaderOptions { |
| 68 ThreadableLoaderOptions() | 68 ThreadableLoaderOptions() |
| 69 : preflightPolicy(ConsiderPreflight) | 69 : preflightPolicy(ConsiderPreflight) |
| 70 , crossOriginRequestPolicy(DenyCrossOriginRequests) | 70 , crossOriginRequestPolicy(DenyCrossOriginRequests) |
| 71 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective) { } | 71 , contentSecurityPolicyEnforcement(EnforceConnectSrcDirective) |
| 72 , timeoutMilliseconds(0) { } |
| 72 | 73 |
| 73 PreflightPolicy preflightPolicy; // If AccessControl is used, how to det
ermine if a preflight is needed. | 74 PreflightPolicy preflightPolicy; // If AccessControl is used, how to det
ermine if a preflight is needed. |
| 74 CrossOriginRequestPolicy crossOriginRequestPolicy; | 75 CrossOriginRequestPolicy crossOriginRequestPolicy; |
| 75 RefPtr<SecurityOrigin> securityOrigin; | 76 RefPtr<SecurityOrigin> securityOrigin; |
| 76 AtomicString initiator; | 77 AtomicString initiator; |
| 77 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; | 78 ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement; |
| 79 unsigned long timeoutMilliseconds; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 // Useful for doing loader operations from any thread (not threadsafe, | 82 // Useful for doing loader operations from any thread (not threadsafe, |
| 81 // just able to run on threads other than the main thread). | 83 // just able to run on threads other than the main thread). |
| 82 class ThreadableLoader { | 84 class ThreadableLoader { |
| 83 WTF_MAKE_NONCOPYABLE(ThreadableLoader); | 85 WTF_MAKE_NONCOPYABLE(ThreadableLoader); |
| 84 public: | 86 public: |
| 85 static void loadResourceSynchronously(ScriptExecutionContext*, const Res
ourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); | 87 static void loadResourceSynchronously(ScriptExecutionContext*, const Res
ourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); |
| 86 static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, Thre
adableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); | 88 static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, Thre
adableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); |
| 87 | 89 |
| 88 virtual void cancel() = 0; | 90 virtual void cancel() = 0; |
| 89 void ref() { refThreadableLoader(); } | 91 void ref() { refThreadableLoader(); } |
| 90 void deref() { derefThreadableLoader(); } | 92 void deref() { derefThreadableLoader(); } |
| 91 | 93 |
| 92 protected: | 94 protected: |
| 93 ThreadableLoader() { } | 95 ThreadableLoader() { } |
| 94 virtual ~ThreadableLoader() { } | 96 virtual ~ThreadableLoader() { } |
| 95 virtual void refThreadableLoader() = 0; | 97 virtual void refThreadableLoader() = 0; |
| 96 virtual void derefThreadableLoader() = 0; | 98 virtual void derefThreadableLoader() = 0; |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 } // namespace WebCore | 101 } // namespace WebCore |
| 100 | 102 |
| 101 #endif // ThreadableLoader_h | 103 #endif // ThreadableLoader_h |
| OLD | NEW |