| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Intel Inc. All rights reserved. | 2 * Copyright (C) 2013 Intel 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 ResourceTimingInfo_h | 31 #ifndef ResourceTimingInfo_h |
| 32 #define ResourceTimingInfo_h | 32 #define ResourceTimingInfo_h |
| 33 | 33 |
| 34 #include "platform/CrossThreadCopier.h" | 34 #include "platform/CrossThreadCopier.h" |
| 35 #include "platform/network/ResourceRequest.h" | 35 #include "platform/network/ResourceRequest.h" |
| 36 #include "platform/network/ResourceResponse.h" | 36 #include "platform/network/ResourceResponse.h" |
| 37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 38 #include "wtf/Functional.h" | 38 #include "wtf/Functional.h" |
| 39 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
| 40 #include "wtf/PtrUtil.h" | |
| 41 #include "wtf/text/AtomicString.h" | 40 #include "wtf/text/AtomicString.h" |
| 42 #include <memory> | |
| 43 | 41 |
| 44 namespace blink { | 42 namespace blink { |
| 45 | 43 |
| 46 struct CrossThreadResourceTimingInfoData; | 44 struct CrossThreadResourceTimingInfoData; |
| 47 | 45 |
| 48 class PLATFORM_EXPORT ResourceTimingInfo { | 46 class PLATFORM_EXPORT ResourceTimingInfo { |
| 49 USING_FAST_MALLOC(ResourceTimingInfo); | 47 USING_FAST_MALLOC(ResourceTimingInfo); |
| 50 WTF_MAKE_NONCOPYABLE(ResourceTimingInfo); | 48 WTF_MAKE_NONCOPYABLE(ResourceTimingInfo); |
| 51 public: | 49 public: |
| 52 static std::unique_ptr<ResourceTimingInfo> create(const AtomicString& type,
const double time, bool isMainResource) | 50 static PassOwnPtr<ResourceTimingInfo> create(const AtomicString& type, const
double time, bool isMainResource) |
| 53 { | 51 { |
| 54 return wrapUnique(new ResourceTimingInfo(type, time, isMainResource)); | 52 return adoptPtr(new ResourceTimingInfo(type, time, isMainResource)); |
| 55 } | 53 } |
| 56 static std::unique_ptr<ResourceTimingInfo> adopt(std::unique_ptr<CrossThread
ResourceTimingInfoData>); | 54 static PassOwnPtr<ResourceTimingInfo> adopt(PassOwnPtr<CrossThreadResourceTi
mingInfoData>); |
| 57 | 55 |
| 58 // Gets a copy of the data suitable for passing to another thread. | 56 // Gets a copy of the data suitable for passing to another thread. |
| 59 std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const; | 57 PassOwnPtr<CrossThreadResourceTimingInfoData> copyData() const; |
| 60 | 58 |
| 61 double initialTime() const { return m_initialTime; } | 59 double initialTime() const { return m_initialTime; } |
| 62 bool isMainResource() const { return m_isMainResource; } | 60 bool isMainResource() const { return m_isMainResource; } |
| 63 | 61 |
| 64 void setInitiatorType(const AtomicString& type) { m_type = type; } | 62 void setInitiatorType(const AtomicString& type) { m_type = type; } |
| 65 const AtomicString& initiatorType() const { return m_type; } | 63 const AtomicString& initiatorType() const { return m_type; } |
| 66 | 64 |
| 67 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } | 65 void setOriginalTimingAllowOrigin(const AtomicString& originalTimingAllowOri
gin) { m_originalTimingAllowOrigin = originalTimingAllowOrigin; } |
| 68 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } | 66 const AtomicString& originalTimingAllowOrigin() const { return m_originalTim
ingAllowOrigin; } |
| 69 | 67 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 struct CrossThreadResourceTimingInfoData { | 105 struct CrossThreadResourceTimingInfoData { |
| 108 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); | 106 WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData); |
| 109 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); | 107 USING_FAST_MALLOC(CrossThreadResourceTimingInfoData); |
| 110 public: | 108 public: |
| 111 CrossThreadResourceTimingInfoData() {} | 109 CrossThreadResourceTimingInfoData() {} |
| 112 | 110 |
| 113 String m_type; | 111 String m_type; |
| 114 String m_originalTimingAllowOrigin; | 112 String m_originalTimingAllowOrigin; |
| 115 double m_initialTime; | 113 double m_initialTime; |
| 116 double m_loadFinishTime; | 114 double m_loadFinishTime; |
| 117 std::unique_ptr<CrossThreadResourceRequestData> m_initialRequest; | 115 OwnPtr<CrossThreadResourceRequestData> m_initialRequest; |
| 118 std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse; | 116 OwnPtr<CrossThreadResourceResponseData> m_finalResponse; |
| 119 Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain; | 117 Vector<OwnPtr<CrossThreadResourceResponseData>> m_redirectChain; |
| 120 bool m_isMainResource; | 118 bool m_isMainResource; |
| 121 }; | 119 }; |
| 122 | 120 |
| 123 template <> | 121 template <> |
| 124 struct CrossThreadCopier<ResourceTimingInfo> { | 122 struct CrossThreadCopier<ResourceTimingInfo> { |
| 125 typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData
>> Type; | 123 typedef WTF::PassedWrapper<PassOwnPtr<CrossThreadResourceTimingInfoData>> Ty
pe; |
| 126 static Type copy(const ResourceTimingInfo& info) { return passed(info.copyDa
ta()); } | 124 static Type copy(const ResourceTimingInfo& info) { return passed(info.copyDa
ta()); } |
| 127 }; | 125 }; |
| 128 | 126 |
| 129 } // namespace blink | 127 } // namespace blink |
| 130 | 128 |
| 131 #endif | 129 #endif |
| OLD | NEW |