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