Commit 7bba2546 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Move PerformanceTiming related fields to the window.

parent 15c7470a
...@@ -3913,7 +3913,6 @@ static void HTMLWindow_unlink(DispatchEx *dispex) ...@@ -3913,7 +3913,6 @@ static void HTMLWindow_unlink(DispatchEx *dispex)
This->local_storage = NULL; This->local_storage = NULL;
IHTMLStorage_Release(local_storage); IHTMLStorage_Release(local_storage);
} }
IHTMLPerformanceTiming_Release(&This->performance_timing->IHTMLPerformanceTiming_iface);
unlink_variant(&This->performance); unlink_variant(&This->performance);
} }
...@@ -4313,19 +4312,12 @@ static void *alloc_window(size_t size) ...@@ -4313,19 +4312,12 @@ static void *alloc_window(size_t size)
static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, HTMLInnerWindow **ret) static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, HTMLInnerWindow **ret)
{ {
HTMLInnerWindow *window; HTMLInnerWindow *window;
HRESULT hres;
window = alloc_window(sizeof(HTMLInnerWindow)); window = alloc_window(sizeof(HTMLInnerWindow));
if(!window) if(!window)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
window->base.IHTMLWindow2_iface.lpVtbl = &HTMLWindow2Vtbl; window->base.IHTMLWindow2_iface.lpVtbl = &HTMLWindow2Vtbl;
hres = create_performance_timing(&window->performance_timing);
if(FAILED(hres)) {
free(window);
return hres;
}
list_init(&window->children); list_init(&window->children);
list_init(&window->script_hosts); list_init(&window->script_hosts);
list_init(&window->bindings); list_init(&window->bindings);
......
...@@ -529,30 +529,6 @@ typedef struct { ...@@ -529,30 +529,6 @@ typedef struct {
HTMLInnerWindow *window; HTMLInnerWindow *window;
} OmHistory; } OmHistory;
typedef struct {
DispatchEx dispex;
IHTMLPerformanceTiming IHTMLPerformanceTiming_iface;
LONG ref;
ULONGLONG navigation_start_time;
ULONGLONG unload_event_start_time;
ULONGLONG unload_event_end_time;
ULONGLONG redirect_time;
ULONGLONG dns_lookup_time;
ULONGLONG connect_time;
ULONGLONG request_time;
ULONGLONG response_start_time;
ULONGLONG response_end_time;
ULONGLONG dom_interactive_time;
ULONGLONG dom_complete_time;
ULONGLONG dom_content_loaded_event_start_time;
ULONGLONG dom_content_loaded_event_end_time;
ULONGLONG load_event_start_time;
ULONGLONG load_event_end_time;
ULONGLONG first_paint_time;
} HTMLPerformanceTiming;
typedef struct nsChannelBSC nsChannelBSC; typedef struct nsChannelBSC nsChannelBSC;
struct HTMLWindow { struct HTMLWindow {
...@@ -628,7 +604,6 @@ struct HTMLInnerWindow { ...@@ -628,7 +604,6 @@ struct HTMLInnerWindow {
BOOL performance_initialized; BOOL performance_initialized;
VARIANT performance; VARIANT performance;
HTMLPerformanceTiming *performance_timing;
unsigned blocking_depth; unsigned blocking_depth;
unsigned parser_callback_cnt; unsigned parser_callback_cnt;
...@@ -647,6 +622,23 @@ struct HTMLInnerWindow { ...@@ -647,6 +622,23 @@ struct HTMLInnerWindow {
ULONG navigation_type; ULONG navigation_type;
ULONG redirect_count; ULONG redirect_count;
ULONGLONG navigation_start_time;
ULONGLONG unload_event_start_time;
ULONGLONG unload_event_end_time;
ULONGLONG redirect_time;
ULONGLONG dns_lookup_time;
ULONGLONG connect_time;
ULONGLONG request_time;
ULONGLONG response_start_time;
ULONGLONG response_end_time;
ULONGLONG dom_interactive_time;
ULONGLONG dom_complete_time;
ULONGLONG dom_content_loaded_event_start_time;
ULONGLONG dom_content_loaded_event_end_time;
ULONGLONG load_event_start_time;
ULONGLONG load_event_end_time;
ULONGLONG first_paint_time;
}; };
typedef enum { typedef enum {
...@@ -1015,7 +1007,6 @@ HRESULT create_location(HTMLOuterWindow*,HTMLLocation**); ...@@ -1015,7 +1007,6 @@ HRESULT create_location(HTMLOuterWindow*,HTMLLocation**);
HRESULT create_navigator(compat_mode_t,IOmNavigator**); HRESULT create_navigator(compat_mode_t,IOmNavigator**);
HRESULT create_html_screen(compat_mode_t,IHTMLScreen**); HRESULT create_html_screen(compat_mode_t,IHTMLScreen**);
HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**); HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**);
HRESULT create_performance_timing(HTMLPerformanceTiming**);
HRESULT create_history(HTMLInnerWindow*,OmHistory**); HRESULT create_history(HTMLInnerWindow*,OmHistory**);
HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**); HRESULT create_namespace_collection(compat_mode_t,IHTMLNamespaceCollection**);
HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**); HRESULT create_dom_implementation(HTMLDocumentNode*,IHTMLDOMImplementation**);
......
...@@ -313,7 +313,7 @@ static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISuppo ...@@ -313,7 +313,7 @@ static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISuppo
bind_event_scripts(This); bind_event_scripts(This);
if(This->window == window) { if(This->window == window) {
window->performance_timing->dom_interactive_time = get_time_stamp(); window->dom_interactive_time = get_time_stamp();
set_ready_state(This->outer_window, READYSTATE_INTERACTIVE); set_ready_state(This->outer_window, READYSTATE_INTERACTIVE);
} }
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
......
...@@ -1095,7 +1095,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) ...@@ -1095,7 +1095,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
IWinInetHttpInfo *wininet_info; IWinInetHttpInfo *wininet_info;
if(This->is_doc_channel) if(This->is_doc_channel)
This->bsc.window->performance_timing->response_start_time = get_time_stamp(); This->bsc.window->response_start_time = get_time_stamp();
This->response_processed = TRUE; This->response_processed = TRUE;
if(This->bsc.binding) { if(This->bsc.binding) {
...@@ -1356,7 +1356,7 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) ...@@ -1356,7 +1356,7 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc)
This->bsc.window->navigation_type = 1; /* TYPE_RELOAD */ This->bsc.window->navigation_type = 1; /* TYPE_RELOAD */
This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE; This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE;
This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); This->bsc.window->navigation_start_time = get_time_stamp();
} }
return S_OK; return S_OK;
...@@ -1524,7 +1524,7 @@ static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result) ...@@ -1524,7 +1524,7 @@ static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result)
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc); nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->is_doc_channel && This->bsc.window) { if(This->is_doc_channel && This->bsc.window) {
This->bsc.window->performance_timing->response_end_time = get_time_stamp(); This->bsc.window->response_end_time = get_time_stamp();
if(result != E_ABORT) { if(result != E_ABORT) {
if(FAILED(result)) if(FAILED(result))
handle_navigation_error(This, result); handle_navigation_error(This, result);
...@@ -1727,21 +1727,21 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t ...@@ -1727,21 +1727,21 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t
case BINDSTATUS_REDIRECTING: case BINDSTATUS_REDIRECTING:
if(This->is_doc_channel) { if(This->is_doc_channel) {
This->bsc.window->redirect_count++; This->bsc.window->redirect_count++;
if(!This->bsc.window->performance_timing->redirect_time) if(!This->bsc.window->redirect_time)
This->bsc.window->performance_timing->redirect_time = get_time_stamp(); This->bsc.window->redirect_time = get_time_stamp();
} }
return handle_redirect(This, status_text); return handle_redirect(This, status_text);
case BINDSTATUS_FINDINGRESOURCE: case BINDSTATUS_FINDINGRESOURCE:
if(This->is_doc_channel && !This->bsc.window->performance_timing->dns_lookup_time) if(This->is_doc_channel && !This->bsc.window->dns_lookup_time)
This->bsc.window->performance_timing->dns_lookup_time = get_time_stamp(); This->bsc.window->dns_lookup_time = get_time_stamp();
break; break;
case BINDSTATUS_CONNECTING: case BINDSTATUS_CONNECTING:
if(This->is_doc_channel) if(This->is_doc_channel)
This->bsc.window->performance_timing->connect_time = get_time_stamp(); This->bsc.window->connect_time = get_time_stamp();
break; break;
case BINDSTATUS_SENDINGREQUEST: case BINDSTATUS_SENDINGREQUEST:
if(This->is_doc_channel) if(This->is_doc_channel)
This->bsc.window->performance_timing->request_time = get_time_stamp(); This->bsc.window->request_time = get_time_stamp();
break; break;
case BINDSTATUS_BEGINDOWNLOADDATA: { case BINDSTATUS_BEGINDOWNLOADDATA: {
IWinInetHttpInfo *http_info; IWinInetHttpInfo *http_info;
...@@ -1798,7 +1798,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code, ...@@ -1798,7 +1798,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code,
HRESULT hres; HRESULT hres;
if(This->is_doc_channel) if(This->is_doc_channel)
This->bsc.window->performance_timing->response_start_time = get_time_stamp(); This->bsc.window->response_start_time = get_time_stamp();
This->response_processed = TRUE; This->response_processed = TRUE;
This->nschannel->response_status = response_code; This->nschannel->response_status = response_code;
......
...@@ -238,7 +238,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns ...@@ -238,7 +238,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns
HRESULT hres; HRESULT hres;
if(doc->window) if(doc->window)
doc->window->performance_timing->dom_content_loaded_event_start_time = get_time_stamp(); doc->window->dom_content_loaded_event_start_time = get_time_stamp();
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
...@@ -247,7 +247,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns ...@@ -247,7 +247,7 @@ static nsresult handle_dom_content_loaded(HTMLDocumentNode *doc, nsIDOMEvent *ns
} }
if(doc->window) if(doc->window)
doc->window->performance_timing->dom_content_loaded_event_end_time = get_time_stamp(); doc->window->dom_content_loaded_event_end_time = get_time_stamp();
return NS_OK; return NS_OK;
} }
...@@ -345,7 +345,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) ...@@ -345,7 +345,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event)
if(doc_obj) if(doc_obj)
handle_docobj_load(doc_obj); handle_docobj_load(doc_obj);
doc->window->performance_timing->dom_complete_time = get_time_stamp(); doc->window->dom_complete_time = get_time_stamp();
set_ready_state(doc->outer_window, READYSTATE_COMPLETE); set_ready_state(doc->outer_window, READYSTATE_COMPLETE);
if(doc_obj) { if(doc_obj) {
...@@ -363,7 +363,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) ...@@ -363,7 +363,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event)
IUnknown_Release(doc_obj->outer_unk); IUnknown_Release(doc_obj->outer_unk);
} }
doc->window->performance_timing->load_event_start_time = get_time_stamp(); doc->window->load_event_start_time = get_time_stamp();
if(doc->dom_document) { if(doc->dom_document) {
hres = create_document_event(doc, EVENTID_LOAD, &load_event); hres = create_document_event(doc, EVENTID_LOAD, &load_event);
...@@ -381,7 +381,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event) ...@@ -381,7 +381,7 @@ static nsresult handle_load(HTMLDocumentNode *doc, nsIDOMEvent *event)
IDOMEvent_Release(&load_event->IDOMEvent_iface); IDOMEvent_Release(&load_event->IDOMEvent_iface);
} }
doc->window->performance_timing->load_event_end_time = get_time_stamp(); doc->window->load_event_end_time = get_time_stamp();
return NS_OK; return NS_OK;
} }
...@@ -406,8 +406,7 @@ static nsresult handle_beforeunload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) ...@@ -406,8 +406,7 @@ static nsresult handle_beforeunload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent)
static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent)
{ {
HTMLPerformanceTiming *timing = NULL; HTMLInnerWindow *window, *pending_window;
HTMLInnerWindow *window;
DOMEvent *event; DOMEvent *event;
HRESULT hres; HRESULT hres;
...@@ -415,11 +414,9 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) ...@@ -415,11 +414,9 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent)
return NS_OK; return NS_OK;
doc->unload_sent = TRUE; doc->unload_sent = TRUE;
if(window->base.outer_window->pending_window) pending_window = window->base.outer_window->pending_window;
timing = window->base.outer_window->pending_window->performance_timing; if(pending_window)
pending_window->unload_event_start_time = get_time_stamp();
if(timing)
timing->unload_event_start_time = get_time_stamp();
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event); hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
...@@ -427,8 +424,8 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent) ...@@ -427,8 +424,8 @@ static nsresult handle_unload(HTMLDocumentNode *doc, nsIDOMEvent *nsevent)
IDOMEvent_Release(&event->IDOMEvent_iface); IDOMEvent_Release(&event->IDOMEvent_iface);
} }
if(timing) if(pending_window)
timing->unload_event_end_time = get_time_stamp(); pending_window->unload_event_end_time = get_time_stamp();
return NS_OK; return NS_OK;
} }
......
...@@ -50,8 +50,8 @@ static void paint_document(HTMLDocumentObj *This) ...@@ -50,8 +50,8 @@ static void paint_document(HTMLDocumentObj *This)
RECT rect; RECT rect;
HDC hdc; HDC hdc;
if(This->window && This->window->base.inner_window && !This->window->base.inner_window->performance_timing->first_paint_time) if(This->window && This->window->base.inner_window && !This->window->base.inner_window->first_paint_time)
This->window->base.inner_window->performance_timing->first_paint_time = get_time_stamp(); This->window->base.inner_window->first_paint_time = get_time_stamp();
GetClientRect(This->hwnd, &rect); GetClientRect(This->hwnd, &rect);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment