| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScriptProfile_h | 31 #ifndef ScriptProfile_h |
| 32 #define ScriptProfile_h | 32 #define ScriptProfile_h |
| 33 | 33 |
| 34 #include "InspectorTypeBuilder.h" | 34 #include "InspectorTypeBuilder.h" |
| 35 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "core/inspector/ScriptProfileNode.h" | 36 #include "core/inspector/ScriptProfileNode.h" |
| 36 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 37 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 class CpuProfile; | 41 class CpuProfile; |
| 41 } | 42 } |
| 42 | 43 |
| 43 namespace WebCore { | 44 namespace WebCore { |
| 44 | 45 |
| 45 class InspectorObject; | 46 class InspectorObject; |
| 46 | 47 |
| 47 class ScriptProfile : public RefCounted<ScriptProfile> { | 48 class ScriptProfile : public RefCounted<ScriptProfile>, public ScriptWrappable { |
| 48 public: | 49 public: |
| 49 static PassRefPtr<ScriptProfile> create(const v8::CpuProfile* profile, doubl
e idleTime) | 50 static PassRefPtr<ScriptProfile> create(const v8::CpuProfile* profile, doubl
e idleTime) |
| 50 { | 51 { |
| 51 return adoptRef(new ScriptProfile(profile, idleTime)); | 52 return adoptRef(new ScriptProfile(profile, idleTime)); |
| 52 } | 53 } |
| 53 virtual ~ScriptProfile(); | 54 virtual ~ScriptProfile(); |
| 54 | 55 |
| 55 String title() const; | 56 String title() const; |
| 56 unsigned int uid() const; | 57 unsigned int uid() const; |
| 57 PassRefPtr<ScriptProfileNode> head() const; | 58 PassRefPtr<ScriptProfileNode> head() const; |
| 58 double idleTime() const; | 59 double idleTime() const; |
| 59 | 60 |
| 60 PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectForHea
d() const; | 61 PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectForHea
d() const; |
| 61 PassRefPtr<TypeBuilder::Array<int> > buildInspectorObjectForSamples() const; | 62 PassRefPtr<TypeBuilder::Array<int> > buildInspectorObjectForSamples() const; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 ScriptProfile(const v8::CpuProfile* profile, double idleTime) | 65 ScriptProfile(const v8::CpuProfile* profile, double idleTime) |
| 65 : m_profile(profile) | 66 : m_profile(profile) |
| 66 , m_idleTime(idleTime) | 67 , m_idleTime(idleTime) |
| 67 {} | 68 { |
| 69 ScriptWrappable::init(this); |
| 70 } |
| 68 | 71 |
| 69 const v8::CpuProfile* m_profile; | 72 const v8::CpuProfile* m_profile; |
| 70 double m_idleTime; | 73 double m_idleTime; |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 } // namespace WebCore | 76 } // namespace WebCore |
| 74 | 77 |
| 75 #endif // ScriptProfile_h | 78 #endif // ScriptProfile_h |
| OLD | NEW |