Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/core/loader/DocumentThreadableLoader.h

Issue 204983007: Make ThreadableLoader class to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 class Document; 48 class Document;
49 class KURL; 49 class KURL;
50 class ResourceRequest; 50 class ResourceRequest;
51 class SecurityOrigin; 51 class SecurityOrigin;
52 class ThreadableLoaderClient; 52 class ThreadableLoaderClient;
53 53
54 class DocumentThreadableLoader FINAL : public RefCounted<DocumentThreadableLoade r>, public ThreadableLoader, private ResourceOwner<RawResource> { 54 class DocumentThreadableLoader FINAL : public RefCounted<DocumentThreadableLoade r>, public ThreadableLoader, private ResourceOwner<RawResource> {
55 WTF_MAKE_FAST_ALLOCATED; 55 WTF_MAKE_FAST_ALLOCATED;
56 public: 56 public:
57 static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); 57 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
58 static PassRefPtr<DocumentThreadableLoader> create(Document*, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); 58 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&);
59 virtual ~DocumentThreadableLoader(); 59 virtual ~DocumentThreadableLoader();
60 60
61 virtual void cancel() OVERRIDE; 61 virtual void cancel() OVERRIDE;
62 void setDefersLoading(bool); 62 void setDefersLoading(bool);
63 63
64 using RefCounted<DocumentThreadableLoader>::ref; 64 using RefCounted<DocumentThreadableLoader>::ref;
65 using RefCounted<DocumentThreadableLoader>::deref; 65 using RefCounted<DocumentThreadableLoader>::deref;
66 66
67 protected: 67 protected:
68 virtual void refThreadableLoader() OVERRIDE { ref(); } 68 virtual void refThreadableLoader() OVERRIDE { ref(); }
69 virtual void derefThreadableLoader() OVERRIDE { deref(); } 69 virtual void derefThreadableLoader() OVERRIDE { deref(); }
70 70
71 private: 71 private:
72 enum BlockingBehavior { 72 enum BlockingBehavior {
73 LoadSynchronously, 73 LoadSynchronously,
74 LoadAsynchronously 74 LoadAsynchronously
75 }; 75 };
76 76
77 DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBeh avior, const ResourceRequest&, const ThreadableLoaderOptions&); 77 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ResourceRequest&, const ThreadableLoaderOptions&);
78 78
79 // RawResourceClient 79 // RawResourceClient
80 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE; 80 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE;
81 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRI DE; 81 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRI DE;
82 virtual void dataReceived(Resource*, const char* data, int dataLength) O VERRIDE; 82 virtual void dataReceived(Resource*, const char* data, int dataLength) O VERRIDE;
83 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc eResponse&) OVERRIDE; 83 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc eResponse&) OVERRIDE;
84 virtual void notifyFinished(Resource*) OVERRIDE; 84 virtual void notifyFinished(Resource*) OVERRIDE;
85 virtual void dataDownloaded(Resource*, int) OVERRIDE; 85 virtual void dataDownloaded(Resource*, int) OVERRIDE;
86 86
87 void cancelWithError(const ResourceError&); 87 void cancelWithError(const ResourceError&);
88 void didReceiveResponse(unsigned long identifier, const ResourceResponse &); 88 void didReceiveResponse(unsigned long identifier, const ResourceResponse &);
89 void didReceiveData(const char* data, int dataLength); 89 void didReceiveData(const char* data, int dataLength);
90 void didFinishLoading(unsigned long identifier, double finishTime); 90 void didFinishLoading(unsigned long identifier, double finishTime);
91 void didTimeout(Timer<DocumentThreadableLoader>*); 91 void didTimeout(Timer<DocumentThreadableLoader>*);
92 void makeCrossOriginAccessRequest(const ResourceRequest&); 92 void makeCrossOriginAccessRequest(const ResourceRequest&);
93 void preflightSuccess(); 93 void preflightSuccess();
94 void preflightFailure(const String& url, const String& errorDescription) ; 94 void preflightFailure(const String& url, const String& errorDescription) ;
95 95
96 void loadRequest(const ResourceRequest&); 96 void loadRequest(const ResourceRequest&);
97 bool isAllowedRedirect(const KURL&) const; 97 bool isAllowedRedirect(const KURL&) const;
98 bool isAllowedByPolicy(const KURL&) const; 98 bool isAllowedByPolicy(const KURL&) const;
99 99
100 SecurityOrigin* securityOrigin() const; 100 SecurityOrigin* securityOrigin() const;
101 101
102 ThreadableLoaderClient* m_client; 102 ThreadableLoaderClient* m_client;
103 Document* m_document; 103 Document& m_document;
104 ThreadableLoaderOptions m_options; 104 ThreadableLoaderOptions m_options;
105 bool m_sameOriginRequest; 105 bool m_sameOriginRequest;
106 bool m_simpleRequest; 106 bool m_simpleRequest;
107 bool m_async; 107 bool m_async;
108 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Contr ol preflight checks 108 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Contr ol preflight checks
109 Timer<DocumentThreadableLoader> m_timeoutTimer; 109 Timer<DocumentThreadableLoader> m_timeoutTimer;
110 }; 110 };
111 111
112 } // namespace WebCore 112 } // namespace WebCore
113 113
114 #endif // DocumentThreadableLoader_h 114 #endif // DocumentThreadableLoader_h
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorResourceAgent.cpp ('k') | Source/core/loader/DocumentThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698