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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceLoader.h

Issue 1710733002: Move multipart resource handling to core/fetch (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup
Patch Set: rebase Created 4 years, 9 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) 2005, 2006, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 void start(); 57 void start();
58 void changeToSynchronous(); 58 void changeToSynchronous();
59 59
60 void cancel(); 60 void cancel();
61 void cancel(const ResourceError&); 61 void cancel(const ResourceError&);
62 void cancelIfNotFinishing(); 62 void cancelIfNotFinishing();
63 63
64 Resource* cachedResource() { return m_resource.get(); } 64 Resource* cachedResource() { return m_resource.get(); }
65 const ResourceRequest& originalRequest() const { return m_originalRequest; } 65 const ResourceRequest& originalRequest() const { return m_originalRequest; }
66 ResourceFetcher* fetcher() { return m_fetcher; }
66 67
67 void setDefersLoading(bool); 68 void setDefersLoading(bool);
68 bool defersLoading() const { return m_defersLoading; } 69 bool defersLoading() const { return m_defersLoading; }
69 70
70 void attachThreadedDataReceiver(PassRefPtrWillBeRawPtr<ThreadedDataReceiver> ); 71 void attachThreadedDataReceiver(PassRefPtrWillBeRawPtr<ThreadedDataReceiver> );
71 72
72 void releaseResources(); 73 void releaseResources();
73 74
74 void didChangePriority(ResourceLoadPriority, int intraPriorityValue); 75 void didChangePriority(ResourceLoadPriority, int intraPriorityValue);
75 76
76 // WebURLLoaderClient 77 // WebURLLoaderClient
77 void willFollowRedirect(WebURLLoader*, WebURLRequest&, const WebURLResponse& redirectResponse) override; 78 void willFollowRedirect(WebURLLoader*, WebURLRequest&, const WebURLResponse& redirectResponse) override;
78 void didSendData(WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; 79 void didSendData(WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
79 void didReceiveResponse(WebURLLoader*, const WebURLResponse&) override; 80 void didReceiveResponse(WebURLLoader*, const WebURLResponse&) override;
80 void didReceiveResponse(WebURLLoader*, const WebURLResponse&, WebDataConsume rHandle*) override; 81 void didReceiveResponse(WebURLLoader*, const WebURLResponse&, WebDataConsume rHandle*) override;
81 void didReceiveData(WebURLLoader*, const char*, int, int encodedDataLength) override; 82 void didReceiveData(WebURLLoader*, const char*, int, int encodedDataLength) override;
82 void didReceiveCachedMetadata(WebURLLoader*, const char* data, int length) o verride; 83 void didReceiveCachedMetadata(WebURLLoader*, const char* data, int length) o verride;
83 void didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataL ength) override; 84 void didFinishLoading(WebURLLoader*, double finishTime, int64_t encodedDataL ength) override;
84 void didFail(WebURLLoader*, const WebURLError&) override; 85 void didFail(WebURLLoader*, const WebURLError&) override;
85 void didDownloadData(WebURLLoader*, int, int) override; 86 void didDownloadData(WebURLLoader*, int, int) override;
86 87
87 const KURL& url() const { return m_request.url(); } 88 const KURL& url() const { return m_request.url(); }
88 bool isLoadedBy(ResourceFetcher*) const; 89 bool isLoadedBy(ResourceFetcher*) const;
89 90
90 bool reachedTerminalState() const { return m_state == Terminated; } 91 bool reachedTerminalState() const { return m_state == Terminated; }
91 const ResourceRequest& request() const { return m_request; } 92 const ResourceRequest& request() const { return m_request; }
92 93 void didFinishLoadingOnePart(double finishTime, int64_t encodedDataLength);
93 bool loadingMultipartContent() const { return m_loadingMultipartContent; }
94 94
95 private: 95 private:
96 // Assumes ResourceFetcher and Resource are non-null. 96 // Assumes ResourceFetcher and Resource are non-null.
97 ResourceLoader(ResourceFetcher*, Resource*, const ResourceLoaderOptions&); 97 ResourceLoader(ResourceFetcher*, Resource*, const ResourceLoaderOptions&);
98 98
99 void init(const ResourceRequest&); 99 void init(const ResourceRequest&);
100 void requestSynchronously(); 100 void requestSynchronously();
101 101
102 void didFinishLoadingOnePart(double finishTime, int64_t encodedDataLength);
103
104 bool responseNeedsAccessControlCheck() const; 102 bool responseNeedsAccessControlCheck() const;
105 103
106 ResourceRequest& applyOptions(ResourceRequest&) const; 104 ResourceRequest& applyOptions(ResourceRequest&) const;
107 105
108 OwnPtr<WebURLLoader> m_loader; 106 OwnPtr<WebURLLoader> m_loader;
109 Member<ResourceFetcher> m_fetcher; 107 Member<ResourceFetcher> m_fetcher;
110 108
111 ResourceRequest m_request; 109 ResourceRequest m_request;
112 ResourceRequest m_originalRequest; // Before redirects. 110 ResourceRequest m_originalRequest; // Before redirects.
113 111
114 bool m_notifiedLoadComplete; 112 bool m_notifiedLoadComplete;
115 113
116 bool m_defersLoading; 114 bool m_defersLoading;
117 bool m_loadingMultipartContent;
118 ResourceRequest m_deferredRequest; 115 ResourceRequest m_deferredRequest;
119 ResourceLoaderOptions m_options; 116 ResourceLoaderOptions m_options;
120 117
121 enum ResourceLoaderState { 118 enum ResourceLoaderState {
122 Initialized, 119 Initialized,
123 Finishing, 120 Finishing,
124 Terminated 121 Terminated
125 }; 122 };
126 123
127 enum ConnectionState { 124 enum ConnectionState {
(...skipping 10 matching lines...) Expand all
138 ResourceLoaderState m_state; 135 ResourceLoaderState m_state;
139 136
140 // Used for sanity checking to make sure we don't experience illegal state 137 // Used for sanity checking to make sure we don't experience illegal state
141 // transitions. 138 // transitions.
142 ConnectionState m_connectionState; 139 ConnectionState m_connectionState;
143 }; 140 };
144 141
145 } // namespace blink 142 } // namespace blink
146 143
147 #endif 144 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698