Merge "[CherryPick] Refactoring: Move the content of HTMLInputElement::subtreeHasChan...
[framework/web/webkit-efl.git] / Source / WebCore / page / Performance.h
1 /*
2  * Copyright (C) 2010 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29  */
30
31 #ifndef Performance_h
32 #define Performance_h
33
34 #if ENABLE(WEB_TIMING)
35
36 #include "DOMWindowProperty.h"
37 #include "EventTarget.h"
38 #include "MemoryInfo.h"
39 #include "PerformanceEntryList.h"
40 #include "PerformanceNavigation.h"
41 #include "PerformanceTiming.h"
42 #include <wtf/PassRefPtr.h>
43 #include <wtf/RefCounted.h>
44 #include <wtf/RefPtr.h>
45 #include <wtf/text/WTFString.h>
46
47 namespace WebCore {
48
49 class Document;
50 class ResourceRequest;
51 class ResourceResponse;
52
53 class Performance : public RefCounted<Performance>, public DOMWindowProperty, public EventTarget {
54 public:
55     static PassRefPtr<Performance> create(Frame* frame) { return adoptRef(new Performance(frame)); }
56     ~Performance();
57
58     virtual const AtomicString& interfaceName() const;
59     virtual ScriptExecutionContext* scriptExecutionContext() const;
60
61     PassRefPtr<MemoryInfo> memory() const;
62     PerformanceNavigation* navigation() const;
63     PerformanceTiming* timing() const;
64     double webkitNow() const;
65
66 #if ENABLE(PERFORMANCE_TIMELINE)
67     PassRefPtr<PerformanceEntryList> webkitGetEntries() const;
68     PassRefPtr<PerformanceEntryList> webkitGetEntriesByType(const String& entryType);
69     PassRefPtr<PerformanceEntryList> webkitGetEntriesByName(const String& name, const String& entryType);
70 #endif
71
72 #if ENABLE(RESOURCE_TIMING)
73     void webkitClearResourceTimings();
74     void webkitSetResourceTimingBufferSize(unsigned int);
75
76     DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitresourcetimingbufferfull);
77
78     void addResourceTiming(const ResourceRequest&, const ResourceResponse&, double finishTime, Document*);
79 #endif
80
81     using RefCounted<Performance>::ref;
82     using RefCounted<Performance>::deref;
83
84 private:
85     explicit Performance(Frame*);
86
87     virtual void refEventTarget() { ref(); }
88     virtual void derefEventTarget() { deref(); }
89     virtual EventTargetData* eventTargetData();
90     virtual EventTargetData* ensureEventTargetData();
91
92     EventTargetData m_eventTargetData;
93
94     mutable RefPtr<PerformanceNavigation> m_navigation;
95     mutable RefPtr<PerformanceTiming> m_timing;
96
97 #if ENABLE(RESOURCE_TIMING)
98     Vector<RefPtr<PerformanceEntry> > m_resourceTimingBuffer;
99 #endif
100 };
101
102 }
103
104 #endif // ENABLE(WEB_TIMING)
105
106 #endif // Performance_h