| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 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 ThreadableLoader, private Resource
Owner<RawResource> { | 54 class DocumentThreadableLoader final : public ThreadableLoader, private Resource
Owner<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&, const ResourceLoaderOp
tions&); | 57 static void loadResourceSynchronously(Document&, const ResourceRequest&,
ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp
tions&); |
| 58 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res
ourceLoaderOptions&); | 58 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable
LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res
ourceLoaderOptions&); |
| 59 virtual ~DocumentThreadableLoader(); | 59 virtual ~DocumentThreadableLoader(); |
| 60 | 60 |
| 61 virtual void overrideTimeout(unsigned long timeout) OVERRIDE; | 61 virtual void overrideTimeout(unsigned long timeout) override; |
| 62 | 62 |
| 63 virtual void cancel() OVERRIDE; | 63 virtual void cancel() override; |
| 64 void setDefersLoading(bool); | 64 void setDefersLoading(bool); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 enum BlockingBehavior { | 67 enum BlockingBehavior { |
| 68 LoadSynchronously, | 68 LoadSynchronously, |
| 69 LoadAsynchronously | 69 LoadAsynchronously |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ResourceRequest&, const ThreadableLoaderOptions&, const ResourceLoa
derOptions&); | 72 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh
avior, const ResourceRequest&, const ThreadableLoaderOptions&, const ResourceLoa
derOptions&); |
| 73 | 73 |
| 74 // RawResourceClient implementation | 74 // RawResourceClient implementation |
| 75 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned
long long totalBytesToBeSent) OVERRIDE; | 75 virtual void dataSent(Resource*, unsigned long long bytesSent, unsigned
long long totalBytesToBeSent) override; |
| 76 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRI
DE; | 76 virtual void responseReceived(Resource*, const ResourceResponse&) overri
de; |
| 77 virtual void dataReceived(Resource*, const char* data, unsigned dataLeng
th) OVERRIDE; | 77 virtual void dataReceived(Resource*, const char* data, unsigned dataLeng
th) override; |
| 78 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc
eResponse&) OVERRIDE; | 78 virtual void redirectReceived(Resource*, ResourceRequest&, const Resourc
eResponse&) override; |
| 79 virtual void notifyFinished(Resource*) OVERRIDE; | 79 virtual void notifyFinished(Resource*) override; |
| 80 virtual void dataDownloaded(Resource*, int) OVERRIDE; | 80 virtual void dataDownloaded(Resource*, int) override; |
| 81 | 81 |
| 82 void cancelWithError(const ResourceError&); | 82 void cancelWithError(const ResourceError&); |
| 83 | 83 |
| 84 // Notify Inspector about resource response. Use this method if response
is not going to be finished normally. | 84 // Notify Inspector about resource response. Use this method if response
is not going to be finished normally. |
| 85 void notifyResponseReceived(unsigned long identifier, const ResourceResp
onse&); | 85 void notifyResponseReceived(unsigned long identifier, const ResourceResp
onse&); |
| 86 | 86 |
| 87 // Methods containing code to handle resource fetch results which is | 87 // Methods containing code to handle resource fetch results which is |
| 88 // common to both sync and async mode. | 88 // common to both sync and async mode. |
| 89 void handleResponse(unsigned long identifier, const ResourceResponse&); | 89 void handleResponse(unsigned long identifier, const ResourceResponse&); |
| 90 void handleReceivedData(const char* data, unsigned dataLength); | 90 void handleReceivedData(const char* data, unsigned dataLength); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 OwnPtr<ResourceLoaderOptions> m_actualOptions; | 133 OwnPtr<ResourceLoaderOptions> m_actualOptions; |
| 134 | 134 |
| 135 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i
n case of a cross-origin redirect. | 135 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i
n case of a cross-origin redirect. |
| 136 Timer<DocumentThreadableLoader> m_timeoutTimer; | 136 Timer<DocumentThreadableLoader> m_timeoutTimer; |
| 137 double m_requestStartedSeconds; // Time an asynchronous fetch request is
started | 137 double m_requestStartedSeconds; // Time an asynchronous fetch request is
started |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| 141 | 141 |
| 142 #endif // DocumentThreadableLoader_h | 142 #endif // DocumentThreadableLoader_h |
| OLD | NEW |