| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ThreadableLoadingContext_h | 5 #ifndef ThreadableLoadingContext_h |
| 6 #define ThreadableLoadingContext_h | 6 #define ThreadableLoadingContext_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" |
| 11 #include "platform/heap/GarbageCollected.h" | 11 #include "platform/heap/GarbageCollected.h" |
| 12 #include "platform/weborigin/KURL.h" | 12 #include "platform/weborigin/KURL.h" |
| 13 #include "platform/wtf/Forward.h" | 13 #include "platform/wtf/Forward.h" |
| 14 #include "platform/wtf/Noncopyable.h" | 14 #include "platform/wtf/Noncopyable.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class Document; | 18 class Document; |
| 19 class ResourceFetcher; | 19 class ResourceFetcher; |
| 20 class SecurityOrigin; | 20 class SecurityOrigin; |
| 21 class WebTaskRunner; | 21 class WebTaskRunner; |
| 22 class WorkerGlobalScope; |
| 22 | 23 |
| 23 // An abstract interface for top-level loading context. | 24 // An abstract interface for top-level loading context. |
| 24 // This should be accessed only from the thread where the loading | 25 // This should be accessed only from the thread where the loading |
| 25 // context is bound to (e.g. on the main thread). | 26 // context is bound to (e.g. on the main thread). |
| 26 class CORE_EXPORT ThreadableLoadingContext | 27 class CORE_EXPORT ThreadableLoadingContext |
| 27 : public GarbageCollected<ThreadableLoadingContext> { | 28 : public GarbageCollected<ThreadableLoadingContext> { |
| 28 WTF_MAKE_NONCOPYABLE(ThreadableLoadingContext); | 29 WTF_MAKE_NONCOPYABLE(ThreadableLoadingContext); |
| 29 | 30 |
| 30 public: | 31 public: |
| 31 static ThreadableLoadingContext* Create(Document&); | 32 static ThreadableLoadingContext* Create(Document&); |
| 33 static ThreadableLoadingContext* Create(WorkerGlobalScope&); |
| 32 | 34 |
| 33 ThreadableLoadingContext() = default; | 35 ThreadableLoadingContext() = default; |
| 34 virtual ~ThreadableLoadingContext() = default; | 36 virtual ~ThreadableLoadingContext() = default; |
| 35 | 37 |
| 36 virtual bool IsContextThread() const = 0; | 38 virtual bool IsContextThread() const = 0; |
| 37 | 39 |
| 38 virtual ResourceFetcher* GetResourceFetcher() = 0; | 40 virtual ResourceFetcher* GetResourceFetcher() = 0; |
| 39 virtual SecurityOrigin* GetSecurityOrigin() = 0; | 41 virtual SecurityOrigin* GetSecurityOrigin() = 0; |
| 40 virtual bool IsSecureContext() const = 0; | 42 virtual bool IsSecureContext() const = 0; |
| 41 virtual KURL FirstPartyForCookies() const = 0; | 43 virtual KURL FirstPartyForCookies() const = 0; |
| 42 virtual String UserAgent() const = 0; | 44 virtual String UserAgent() const = 0; |
| 43 virtual RefPtr<WebTaskRunner> GetTaskRunner(TaskType) = 0; | 45 virtual RefPtr<WebTaskRunner> GetTaskRunner(TaskType) = 0; |
| 44 virtual void RecordUseCount(UseCounter::Feature) = 0; | 46 virtual void RecordUseCount(UseCounter::Feature) = 0; |
| 45 | 47 |
| 46 // TODO(kinuko): Try getting rid of dependency to Document. | 48 // TODO(kinuko): Try getting rid of dependency to Document. |
| 47 virtual Document* GetLoadingDocument() { return nullptr; } | 49 virtual Document* GetLoadingDocument() { return nullptr; } |
| 48 | 50 |
| 49 DEFINE_INLINE_VIRTUAL_TRACE() {} | 51 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // namespace blink | 54 } // namespace blink |
| 53 | 55 |
| 54 #endif // ThreadableLoadingContext_h | 56 #endif // ThreadableLoadingContext_h |
| OLD | NEW |