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 | 22 |
23 // An abstract interface for top-level loading context. | 23 // An abstract interface for top-level loading context. |
24 // This should be accessed only from the thread where the loading | 24 // This should be accessed only from the thread where the loading |
25 // context is bound to (e.g. on the main thread). | 25 // context is bound to (e.g. on the main thread). |
26 class CORE_EXPORT ThreadableLoadingContext | 26 class CORE_EXPORT ThreadableLoadingContext : public GarbageCollectedMixin { |
27 : public GarbageCollected<ThreadableLoadingContext> { | |
28 WTF_MAKE_NONCOPYABLE(ThreadableLoadingContext); | 27 WTF_MAKE_NONCOPYABLE(ThreadableLoadingContext); |
29 | 28 |
30 public: | 29 public: |
31 static ThreadableLoadingContext* Create(Document&); | 30 static ThreadableLoadingContext* Create(Document&); |
32 | 31 |
33 ThreadableLoadingContext() = default; | 32 ThreadableLoadingContext() = default; |
34 virtual ~ThreadableLoadingContext() = default; | 33 virtual ~ThreadableLoadingContext() = default; |
35 | 34 |
36 virtual bool IsContextThread() const = 0; | 35 virtual bool IsContextThread() const = 0; |
37 | 36 |
38 virtual ResourceFetcher* GetResourceFetcher() = 0; | 37 virtual ResourceFetcher* GetResourceFetcher() = 0; |
39 virtual SecurityOrigin* GetSecurityOrigin() = 0; | 38 virtual SecurityOrigin* GetSecurityOrigin() = 0; |
40 virtual bool IsSecureContext() const = 0; | 39 virtual bool IsSecureContext() const = 0; |
41 virtual KURL FirstPartyForCookies() const = 0; | 40 virtual KURL FirstPartyForCookies() const = 0; |
42 virtual String UserAgent() const = 0; | 41 virtual String UserAgent() const = 0; |
43 virtual RefPtr<WebTaskRunner> GetTaskRunner(TaskType) = 0; | 42 virtual RefPtr<WebTaskRunner> GetTaskRunner(TaskType) = 0; |
44 virtual void RecordUseCount(UseCounter::Feature) = 0; | 43 virtual void RecordUseCount(UseCounter::Feature) = 0; |
45 | 44 |
46 // TODO(kinuko): Try getting rid of dependency to Document. | 45 // TODO(kinuko): Try getting rid of dependency to Document. |
47 virtual Document* GetLoadingDocument() { return nullptr; } | 46 virtual Document* GetLoadingDocument() { return nullptr; } |
48 | 47 |
49 DEFINE_INLINE_VIRTUAL_TRACE() {} | 48 DEFINE_INLINE_VIRTUAL_TRACE() {} |
50 }; | 49 }; |
51 | 50 |
52 } // namespace blink | 51 } // namespace blink |
53 | 52 |
54 #endif // ThreadableLoadingContext_h | 53 #endif // ThreadableLoadingContext_h |
OLD | NEW |