OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 #include "wtf/MainThread.h" | 110 #include "wtf/MainThread.h" |
111 #include "wtf/MathExtras.h" | 111 #include "wtf/MathExtras.h" |
112 #include "wtf/text/WTFString.h" | 112 #include "wtf/text/WTFString.h" |
113 #include <algorithm> | 113 #include <algorithm> |
114 | 114 |
115 using std::min; | 115 using std::min; |
116 using std::max; | 116 using std::max; |
117 | 117 |
118 namespace blink { | 118 namespace blink { |
119 | 119 |
120 class PostMessageTimer FINAL : public SuspendableTimer { | 120 class PostMessageTimer final : public SuspendableTimer { |
121 public: | 121 public: |
122 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) | 122 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) |
123 : SuspendableTimer(window.document()) | 123 : SuspendableTimer(window.document()) |
124 , m_window(&window) | 124 , m_window(&window) |
125 , m_message(message) | 125 , m_message(message) |
126 , m_origin(sourceOrigin) | 126 , m_origin(sourceOrigin) |
127 , m_source(source) | 127 , m_source(source) |
128 , m_channels(channels) | 128 , m_channels(channels) |
129 , m_targetOrigin(targetOrigin) | 129 , m_targetOrigin(targetOrigin) |
130 , m_stackTrace(stackTrace) | 130 , m_stackTrace(stackTrace) |
131 , m_userGestureToken(userGestureToken) | 131 , m_userGestureToken(userGestureToken) |
132 { | 132 { |
133 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti
ng(executionContext(), "postMessage"); | 133 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti
ng(executionContext(), "postMessage"); |
134 } | 134 } |
135 | 135 |
136 PassRefPtrWillBeRawPtr<MessageEvent> event() | 136 PassRefPtrWillBeRawPtr<MessageEvent> event() |
137 { | 137 { |
138 return MessageEvent::create(m_channels.release(), m_message, m_origin, S
tring(), m_source.get()); | 138 return MessageEvent::create(m_channels.release(), m_message, m_origin, S
tring(), m_source.get()); |
139 | 139 |
140 } | 140 } |
141 SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } | 141 SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } |
142 ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } | 142 ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } |
143 UserGestureToken* userGestureToken() const { return m_userGestureToken.get()
; } | 143 UserGestureToken* userGestureToken() const { return m_userGestureToken.get()
; } |
144 LocalDOMWindow* source() const { return m_source.get(); } | 144 LocalDOMWindow* source() const { return m_source.get(); } |
145 | 145 |
146 private: | 146 private: |
147 virtual void fired() OVERRIDE | 147 virtual void fired() override |
148 { | 148 { |
149 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceA
syncOperationCompletedCallbackStarting(executionContext(), m_asyncOperationId); | 149 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceA
syncOperationCompletedCallbackStarting(executionContext(), m_asyncOperationId); |
150 m_window->postMessageTimerFired(this); | 150 m_window->postMessageTimerFired(this); |
151 // This object is deleted now. | 151 // This object is deleted now. |
152 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 152 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
153 } | 153 } |
154 | 154 |
155 // FIXME: Oilpan: This raw pointer is safe because the PostMessageTimer is | 155 // FIXME: Oilpan: This raw pointer is safe because the PostMessageTimer is |
156 // owned by the LocalDOMWindow. Ideally PostMessageTimer should be moved to | 156 // owned by the LocalDOMWindow. Ideally PostMessageTimer should be moved to |
157 // the heap and use Member<LocalDOMWindow>. | 157 // the heap and use Member<LocalDOMWindow>. |
(...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 FrameDestructionObserver::trace(visitor); | 1908 FrameDestructionObserver::trace(visitor); |
1909 } | 1909 } |
1910 | 1910 |
1911 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1911 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1912 { | 1912 { |
1913 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1913 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1914 return v8::Handle<v8::Object>(); | 1914 return v8::Handle<v8::Object>(); |
1915 } | 1915 } |
1916 | 1916 |
1917 } // namespace blink | 1917 } // namespace blink |
OLD | NEW |