| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DoNotAllowStoredCredentials | 48 DoNotAllowStoredCredentials |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 enum CrossOriginRequestPolicy { | 51 enum CrossOriginRequestPolicy { |
| 52 DenyCrossOriginRequests, | 52 DenyCrossOriginRequests, |
| 53 UseAccessControl, | 53 UseAccessControl, |
| 54 AllowCrossOriginRequests | 54 AllowCrossOriginRequests |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 struct ThreadableLoaderOptions { | 57 struct ThreadableLoaderOptions { |
| 58 ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false
), allowCredentials(false), forcePreflight(false), crossOriginRequestPolicy(Deny
CrossOriginRequests) { } | 58 ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false
), allowCredentials(false), forcePreflight(false), crossOriginRequestPolicy(Deny
CrossOriginRequests), shouldBufferData(true) { } |
| 59 bool sendLoadCallbacks; | 59 bool sendLoadCallbacks; |
| 60 bool sniffContent; | 60 bool sniffContent; |
| 61 bool allowCredentials; // Whether HTTP credentials and cookies are sent
with the request. | 61 bool allowCredentials; // Whether HTTP credentials and cookies are sent
with the request. |
| 62 bool forcePreflight; // If AccessControl is used, whether to force a pr
eflight. | 62 bool forcePreflight; // If AccessControl is used, whether to force a pr
eflight. |
| 63 CrossOriginRequestPolicy crossOriginRequestPolicy; | 63 CrossOriginRequestPolicy crossOriginRequestPolicy; |
| 64 bool shouldBufferData; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 // Useful for doing loader operations from any thread (not threadsafe, | 67 // Useful for doing loader operations from any thread (not threadsafe, |
| 67 // just able to run on threads other than the main thread). | 68 // just able to run on threads other than the main thread). |
| 68 class ThreadableLoader { | 69 class ThreadableLoader { |
| 69 WTF_MAKE_NONCOPYABLE(ThreadableLoader); | 70 WTF_MAKE_NONCOPYABLE(ThreadableLoader); |
| 70 public: | 71 public: |
| 71 static void loadResourceSynchronously(ScriptExecutionContext*, const Res
ourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); | 72 static void loadResourceSynchronously(ScriptExecutionContext*, const Res
ourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); |
| 72 static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, Thre
adableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); | 73 static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, Thre
adableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); |
| 73 | 74 |
| 74 virtual void cancel() = 0; | 75 virtual void cancel() = 0; |
| 75 void ref() { refThreadableLoader(); } | 76 void ref() { refThreadableLoader(); } |
| 76 void deref() { derefThreadableLoader(); } | 77 void deref() { derefThreadableLoader(); } |
| 77 | 78 |
| 78 protected: | 79 protected: |
| 79 ThreadableLoader() { } | 80 ThreadableLoader() { } |
| 80 virtual ~ThreadableLoader() { } | 81 virtual ~ThreadableLoader() { } |
| 81 virtual void refThreadableLoader() = 0; | 82 virtual void refThreadableLoader() = 0; |
| 82 virtual void derefThreadableLoader() = 0; | 83 virtual void derefThreadableLoader() = 0; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace WebCore | 86 } // namespace WebCore |
| 86 | 87 |
| 87 #endif // ThreadableLoader_h | 88 #endif // ThreadableLoader_h |
| OLD | NEW |