Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| =================================================================== |
| --- content/renderer/render_thread_impl.cc (revision 133749) |
| +++ content/renderer/render_thread_impl.cc (working copy) |
| @@ -57,6 +57,7 @@ |
| #include "content/renderer/render_view_impl.h" |
| #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| #include "content/renderer/renderer_webstoragearea_impl.h" |
| +#include "content/renderer/renderer_webstoragenamespace_impl.h" |
| #include "grit/content_resources.h" |
| #include "ipc/ipc_channel_handle.h" |
| #include "ipc/ipc_platform_file.h" |
| @@ -813,32 +814,40 @@ |
| void RenderThreadImpl::OnDOMStorageEvent( |
| const DOMStorageMsg_Event_Params& params) { |
| - if (!dom_storage_event_dispatcher_.get()) { |
| - EnsureWebKitInitialized(); |
| - dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create()); |
| + EnsureWebKitInitialized(); |
| + |
| + bool originated_in_process = params.connection_id != 0; |
| + RendererWebStorageAreaImpl* originating_area = NULL; |
| + if (originated_in_process) { |
| + originating_area = RendererWebStorageAreaImpl::FromConnectionId( |
| + params.connection_id); |
| } |
| - // TODO(michaeln): Return early until webkit/webcore is modified to not |
| - // raise LocalStorage events internally. Looks like i have some multi-side |
| - // patch engineering in front of me todo. |
| - if (params.connection_id) |
| - return; |
| - |
| - // TODO(michaeln): fix the webkit api so we don't need to convert from |
| - // string types to url types and to pass in the 'area' which |
| - // caused this event to occur and to get rid of the is_local param. |
| - // RendererWebStorageAreaImpl* originating_area = |
| - // RendererWebStorageAreaImpl::FromConnectionId(params.connection_id); |
| - |
| - // SessionStorage events are always raised internally by webkit/webcore. |
| - const bool kIsLocalStorage = true; |
| - dom_storage_event_dispatcher_->dispatchStorageEvent( |
| - params.key, |
| - params.old_value, |
| - params.new_value, |
| - UTF8ToUTF16(params.origin.spec()), |
| - params.page_url, |
| - kIsLocalStorage); |
| + if (params.namespace_id == dom_storage::kLocalStorageNamespaceId) { |
| + WebStorageEventDispatcher::dispatchLocalStorageEvent( |
| + params.key, |
| + params.old_value, |
| + params.new_value, |
| + params.origin, |
| + params.page_url, |
| + originating_area, |
| + originated_in_process); |
| + } else if (originated_in_process) { |
| + // For now, we only raise session storage events into the process which |
| + // cause the event to occur. However there are cases where sessions |
| + // can span process boundaries, so there are correctness issues here. |
|
ericu
2012/04/25 19:40:35
Should be a TODO to make it more obvious.
michaeln
2012/04/25 20:22:12
Done
|
| + RendererWebStorageNamespaceImpl |
| + session_namespace_for_event_dispatch(params.namespace_id); |
| + WebStorageEventDispatcher::dispatchSessionStorageEvent( |
| + params.key, |
| + params.old_value, |
| + params.new_value, |
| + params.origin, |
| + params.page_url, |
| + session_namespace_for_event_dispatch, |
| + originating_area, |
| + originated_in_process); |
| + } |
| } |
| bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |