| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 template<> struct CrossThreadCopierBase<false, false, false, ThreadableLoade
rOptions> { | 108 template<> struct CrossThreadCopierBase<false, false, false, ThreadableLoade
rOptions> { |
| 109 typedef CrossThreadThreadableLoaderOptionsData Type; | 109 typedef CrossThreadThreadableLoaderOptionsData Type; |
| 110 static Type copy(const ThreadableLoaderOptions& options) | 110 static Type copy(const ThreadableLoaderOptions& options) |
| 111 { | 111 { |
| 112 return CrossThreadThreadableLoaderOptionsData(options); | 112 return CrossThreadThreadableLoaderOptionsData(options); |
| 113 } | 113 } |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 // Useful for doing loader operations from any thread (not threadsafe, | 116 // Useful for doing loader operations from any thread (not threadsafe, |
| 117 // just able to run on threads other than the main thread). | 117 // just able to run on threads other than the main thread). |
| 118 // |
| 119 // Arguments common to both loadResourceSynchronously() and create(): |
| 120 // |
| 121 // - ThreadableLoaderOptions argument configures this ThreadableLoader's |
| 122 // behavior. |
| 123 // |
| 124 // - ResourceLoaderOptions argument will be passed to the FetchRequest |
| 125 // that this ThreadableLoader creates. It can be altered e.g. when |
| 126 // redirect happens. |
| 118 class CORE_EXPORT ThreadableLoader : public RefCounted<ThreadableLoader> { | 127 class CORE_EXPORT ThreadableLoader : public RefCounted<ThreadableLoader> { |
| 119 WTF_MAKE_NONCOPYABLE(ThreadableLoader); | 128 WTF_MAKE_NONCOPYABLE(ThreadableLoader); |
| 120 public: | 129 public: |
| 121 // ThreadableLoaderOptions argument configures this ThreadableLoader's | |
| 122 // behavior. | |
| 123 // | |
| 124 // ResourceLoaderOptions argument will be passed to the FetchRequest | |
| 125 // that this ThreadableLoader creates. It can be altered e.g. when | |
| 126 // redirect happens. | |
| 127 static void loadResourceSynchronously(ExecutionContext&, const ResourceR
equest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const Resource
LoaderOptions&); | 130 static void loadResourceSynchronously(ExecutionContext&, const ResourceR
equest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const Resource
LoaderOptions&); |
| 131 // The following ThreadableLoaderClient methods may destroy the |
| 132 // ThreadableLoader instance in them. |
| 133 // - didFinishLoading() |
| 134 // - didFail() |
| 135 // - didFailAccessControlCheck() |
| 136 // - didFailRedirectCheck() |
| 128 static PassRefPtr<ThreadableLoader> create(ExecutionContext&, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res
ourceLoaderOptions&); | 137 static PassRefPtr<ThreadableLoader> create(ExecutionContext&, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res
ourceLoaderOptions&); |
| 129 | 138 |
| 130 // A ThreadableLoader may have a timeout specified. It is possible, in s
ome cases, for | 139 // A ThreadableLoader may have a timeout specified. It is possible, in s
ome cases, for |
| 131 // the timeout to be overridden after the request is sent (for example,
XMLHttpRequests | 140 // the timeout to be overridden after the request is sent (for example,
XMLHttpRequests |
| 132 // may override their timeout setting after sending). | 141 // may override their timeout setting after sending). |
| 133 // | 142 // |
| 134 // Set a new timeout relative to the time the request started, in millis
econds. | 143 // Set a new timeout relative to the time the request started, in millis
econds. |
| 135 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; | 144 virtual void overrideTimeout(unsigned long timeoutMilliseconds) = 0; |
| 136 | 145 |
| 137 virtual void cancel() = 0; | 146 virtual void cancel() = 0; |
| 138 | 147 |
| 139 virtual ~ThreadableLoader() { } | 148 virtual ~ThreadableLoader() { } |
| 140 | 149 |
| 141 protected: | 150 protected: |
| 142 ThreadableLoader() { } | 151 ThreadableLoader() { } |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 } // namespace blink | 154 } // namespace blink |
| 146 | 155 |
| 147 #endif // ThreadableLoader_h | 156 #endif // ThreadableLoader_h |
| OLD | NEW |