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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef WebURLResponse_h | 31 #ifndef WebURLResponse_h |
32 #define WebURLResponse_h | 32 #define WebURLResponse_h |
33 | 33 |
34 #include "public/platform/WebCString.h" | 34 #include "public/platform/WebCString.h" |
35 #include "public/platform/WebCommon.h" | 35 #include "public/platform/WebCommon.h" |
36 #include "public/platform/WebPrivateOwnPtr.h" | 36 #include "public/platform/WebPrivateOwnPtr.h" |
37 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
38 #include "public/platform/WebVector.h" | 38 #include "public/platform/WebVector.h" |
39 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h" | 39 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseType.h" |
| 40 #include <memory> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class ResourceResponse; | 44 class ResourceResponse; |
44 class WebHTTPHeaderVisitor; | 45 class WebHTTPHeaderVisitor; |
45 class WebHTTPLoadInfo; | 46 class WebHTTPLoadInfo; |
46 class WebURL; | 47 class WebURL; |
47 class WebURLLoadTiming; | 48 class WebURLLoadTiming; |
48 class WebURLResponsePrivate; | 49 class WebURLResponsePrivate; |
49 | 50 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 size_t numUnknownScts; | 86 size_t numUnknownScts; |
86 size_t numInvalidScts; | 87 size_t numInvalidScts; |
87 size_t numValidScts; | 88 size_t numValidScts; |
88 }; | 89 }; |
89 | 90 |
90 class ExtraData { | 91 class ExtraData { |
91 public: | 92 public: |
92 virtual ~ExtraData() { } | 93 virtual ~ExtraData() { } |
93 }; | 94 }; |
94 | 95 |
95 ~WebURLResponse() { reset(); } | 96 BLINK_PLATFORM_EXPORT ~WebURLResponse(); |
96 | 97 |
97 WebURLResponse() : m_private(0) { } | 98 BLINK_PLATFORM_EXPORT WebURLResponse(); |
98 WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); } | 99 BLINK_PLATFORM_EXPORT WebURLResponse(const WebURLResponse&); |
99 WebURLResponse& operator=(const WebURLResponse& r) | 100 BLINK_PLATFORM_EXPORT WebURLResponse& operator=(const WebURLResponse&); |
100 { | |
101 assign(r); | |
102 return *this; | |
103 } | |
104 | 101 |
105 explicit WebURLResponse(const WebURL& url) : m_private(0) | 102 BLINK_PLATFORM_EXPORT explicit WebURLResponse(const WebURL&); |
106 { | |
107 initialize(); | |
108 setURL(url); | |
109 } | |
110 | |
111 BLINK_PLATFORM_EXPORT void initialize(); | |
112 BLINK_PLATFORM_EXPORT void reset(); | |
113 BLINK_PLATFORM_EXPORT void assign(const WebURLResponse&); | |
114 | 103 |
115 BLINK_PLATFORM_EXPORT bool isNull() const; | 104 BLINK_PLATFORM_EXPORT bool isNull() const; |
116 | 105 |
117 BLINK_PLATFORM_EXPORT WebURL url() const; | 106 BLINK_PLATFORM_EXPORT WebURL url() const; |
118 BLINK_PLATFORM_EXPORT void setURL(const WebURL&); | 107 BLINK_PLATFORM_EXPORT void setURL(const WebURL&); |
119 | 108 |
120 BLINK_PLATFORM_EXPORT unsigned connectionID() const; | 109 BLINK_PLATFORM_EXPORT unsigned connectionID() const; |
121 BLINK_PLATFORM_EXPORT void setConnectionID(unsigned); | 110 BLINK_PLATFORM_EXPORT void setConnectionID(unsigned); |
122 | 111 |
123 BLINK_PLATFORM_EXPORT bool connectionReused() const; | 112 BLINK_PLATFORM_EXPORT bool connectionReused() const; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // Extra data associated with the underlying resource response. Resource | 244 // Extra data associated with the underlying resource response. Resource |
256 // responses can be copied. If non-null, each copy of a resource response | 245 // responses can be copied. If non-null, each copy of a resource response |
257 // holds a pointer to the extra data, and the extra data pointer will be | 246 // holds a pointer to the extra data, and the extra data pointer will be |
258 // deleted when the last resource response is destroyed. Setting the extra | 247 // deleted when the last resource response is destroyed. Setting the extra |
259 // data pointer will cause the underlying resource response to be | 248 // data pointer will cause the underlying resource response to be |
260 // dissociated from any existing non-null extra data pointer. | 249 // dissociated from any existing non-null extra data pointer. |
261 BLINK_PLATFORM_EXPORT ExtraData* getExtraData() const; | 250 BLINK_PLATFORM_EXPORT ExtraData* getExtraData() const; |
262 BLINK_PLATFORM_EXPORT void setExtraData(ExtraData*); | 251 BLINK_PLATFORM_EXPORT void setExtraData(ExtraData*); |
263 | 252 |
264 protected: | 253 protected: |
| 254 // Permit subclasses to avoid allocating a default instance of |m_private| |
| 255 // on construction. Parameter must be non-null. |
| 256 BLINK_PLATFORM_EXPORT explicit WebURLResponse(WebURLResponsePrivate*); |
| 257 // Parameter must be non-null. |
265 BLINK_PLATFORM_EXPORT void assign(WebURLResponsePrivate*); | 258 BLINK_PLATFORM_EXPORT void assign(WebURLResponsePrivate*); |
266 | 259 |
267 private: | 260 private: |
| 261 // m_private->dispose() will be called on destruction. This normally |
| 262 // deletes the object, but subclasses may change this behaviour. Never null. |
268 WebURLResponsePrivate* m_private; | 263 WebURLResponsePrivate* m_private; |
269 }; | 264 }; |
270 | 265 |
271 } // namespace blink | 266 } // namespace blink |
272 | 267 |
273 #endif | 268 #endif |
OLD | NEW |