diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 03:33:40 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 03:33:40 +0000 |
commit | b5126da4daa8f0f0f408afb93e0683f1cf34c82a (patch) | |
tree | b08cb1a52886ec739c9ae7627249f0f3e820591c | |
parent | b4b34c8faaaae0b270aae8d2a05b6086664a9a1e (diff) | |
download | chromium_src-b5126da4daa8f0f0f408afb93e0683f1cf34c82a.zip chromium_src-b5126da4daa8f0f0f408afb93e0683f1cf34c82a.tar.gz chromium_src-b5126da4daa8f0f0f408afb93e0683f1cf34c82a.tar.bz2 |
Revert 254514 "Revert 254507 "Reland "Move WebKitPlatformSupport..."
This builds locally and on CQ. Relanding and will keep an eye out on bots, and clobber if necessary.
> Revert 254507 "Reland "Move WebKitPlatformSupportImpl over to co..."
>
> > Reland "Move WebKitPlatformSupportImpl over to content."
> >
> > In the process rename it BlinkPlatformImpl to avoid conflicts and
> > confusion with an existing WebKitPlatformSupportImpl class in content.
> >
> > This step is necessary because WebKitPlatformSupportImpl uses
> > webkit/common/user_agent/, and we also want to move user_agent to
> > content.
> >
> > So this needs to happen first because webkit can't depend on content as
> > content already depends on webkit, otherwise we would be creating a
> > circular dependency.
> >
> > WebURLLoader and WebSocketStreamHandleImpl had to be moved with
> > WebKitPlatformSupportImpl, because they both uses
> > WebKitPlatformSupportImpl and vice-versa.
> >
> > BUG=265753, 338338, 237249
> > TEST=content_unittests
> > R=jam@chromium.org
> > TBR=darin
> >
> > Review URL: https://codereview.chromium.org/180153012
>
> TBR=tfarina@chromium.org
>
> Review URL: https://codereview.chromium.org/180383006
TBR=stgao@chromium.org
Review URL: https://codereview.chromium.org/186363002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254641 0039d316-1c4b-4281-b951-d872f2087c98
26 files changed, 197 insertions, 249 deletions
diff --git a/webkit/child/webkitplatformsupport_impl.cc b/content/child/blink_platform_impl.cc index 1c55e13..a5fd1d2 100644 --- a/webkit/child/webkitplatformsupport_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/child/webkitplatformsupport_impl.h" +#include "content/child/blink_platform_impl.h" #include <math.h> @@ -26,6 +26,8 @@ #include "base/synchronization/lock.h" #include "base/sys_info.h" #include "base/time/time.h" +#include "content/child/web_socket_stream_handle_impl.h" +#include "content/child/web_url_loader_impl.h" #include "grit/blink_resources.h" #include "grit/webkit_resources.h" #include "grit/webkit_strings.h" @@ -36,8 +38,6 @@ #include "third_party/WebKit/public/platform/WebString.h" #include "ui/base/layout.h" #include "webkit/child/webkit_child_helpers.h" -#include "webkit/child/websocketstreamhandle_impl.h" -#include "webkit/child/weburlloader_impl.h" #include "webkit/common/user_agent/user_agent.h" #if defined(OS_ANDROID) @@ -106,9 +106,9 @@ class MemoryUsageCache { base::Lock lock_; }; -} // anonymous namespace +} // namespace -namespace webkit_glue { +namespace content { static int ToMessageID(WebLocalizedString::Name name) { switch (name) { @@ -344,29 +344,29 @@ static int ToMessageID(WebLocalizedString::Name name) { return -1; } -WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() +BlinkPlatformImpl::BlinkPlatformImpl() : main_loop_(base::MessageLoop::current()), shared_timer_func_(NULL), shared_timer_fire_time_(0.0), shared_timer_fire_time_was_set_while_suspended_(false), shared_timer_suspended_(0) {} -WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { +BlinkPlatformImpl::~BlinkPlatformImpl() { } -WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() { +WebURLLoader* BlinkPlatformImpl::createURLLoader() { return new WebURLLoaderImpl(this); } -WebSocketStreamHandle* WebKitPlatformSupportImpl::createSocketStreamHandle() { +WebSocketStreamHandle* BlinkPlatformImpl::createSocketStreamHandle() { return new WebSocketStreamHandleImpl(this); } -WebString WebKitPlatformSupportImpl::userAgent(const WebURL& url) { +WebString BlinkPlatformImpl::userAgent(const WebURL& url) { return WebString::fromUTF8(webkit_glue::GetUserAgent(url)); } -WebData WebKitPlatformSupportImpl::parseDataURL( +WebData BlinkPlatformImpl::parseDataURL( const WebURL& url, WebString& mimetype_out, WebString& charset_out) { @@ -380,20 +380,20 @@ WebData WebKitPlatformSupportImpl::parseDataURL( return WebData(); } -WebURLError WebKitPlatformSupportImpl::cancelledError( +WebURLError BlinkPlatformImpl::cancelledError( const WebURL& unreachableURL) const { return WebURLLoaderImpl::CreateError(unreachableURL, false, net::ERR_ABORTED); } -void WebKitPlatformSupportImpl::decrementStatsCounter(const char* name) { +void BlinkPlatformImpl::decrementStatsCounter(const char* name) { base::StatsCounter(name).Decrement(); } -void WebKitPlatformSupportImpl::incrementStatsCounter(const char* name) { +void BlinkPlatformImpl::incrementStatsCounter(const char* name) { base::StatsCounter(name).Increment(); } -void WebKitPlatformSupportImpl::histogramCustomCounts( +void BlinkPlatformImpl::histogramCustomCounts( const char* name, int sample, int min, int max, int bucket_count) { // Copied from histogram macro, but without the static variable caching // the histogram because name is dynamic. @@ -404,7 +404,7 @@ void WebKitPlatformSupportImpl::histogramCustomCounts( counter->Add(sample); } -void WebKitPlatformSupportImpl::histogramEnumeration( +void BlinkPlatformImpl::histogramEnumeration( const char* name, int sample, int boundary_value) { // Copied from histogram macro, but without the static variable caching // the histogram because name is dynamic. @@ -415,18 +415,18 @@ void WebKitPlatformSupportImpl::histogramEnumeration( counter->Add(sample); } -void WebKitPlatformSupportImpl::histogramSparse(const char* name, int sample) { +void BlinkPlatformImpl::histogramSparse(const char* name, int sample) { // For sparse histograms, we can use the macro, as it does not incorporate a // static. UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); } -const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag( +const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( const char* category_group) { return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); } -long* WebKitPlatformSupportImpl::getTraceSamplingState( +long* BlinkPlatformImpl::getTraceSamplingState( const unsigned thread_bucket) { switch (thread_bucket) { case 0: @@ -446,7 +446,7 @@ COMPILE_ASSERT( sizeof(base::debug::TraceEventHandle), TraceEventHandle_types_must_be_same_size); -blink::Platform::TraceEventHandle WebKitPlatformSupportImpl::addTraceEvent( +blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( char phase, const unsigned char* category_group_enabled, const char* name, @@ -464,7 +464,7 @@ blink::Platform::TraceEventHandle WebKitPlatformSupportImpl::addTraceEvent( return result; } -void WebKitPlatformSupportImpl::updateTraceEventDuration( +void BlinkPlatformImpl::updateTraceEventDuration( const unsigned char* category_group_enabled, const char* name, TraceEventHandle handle) { @@ -476,7 +476,7 @@ void WebKitPlatformSupportImpl::updateTraceEventDuration( namespace { -WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform, +WebData loadAudioSpatializationResource(BlinkPlatformImpl* platform, const char* name) { #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE if (!strcmp(name, "Composite")) { @@ -648,7 +648,7 @@ const DataResource kDataResources[] = { } // namespace -WebData WebKitPlatformSupportImpl::loadResource(const char* name) { +WebData BlinkPlatformImpl::loadResource(const char* name) { // Some clients will call into this method with an empty |name| when they have // optional resources. For example, the PopupMenuChromium code can have icons // for some Autofill items but not for others. @@ -675,7 +675,7 @@ WebData WebKitPlatformSupportImpl::loadResource(const char* name) { return WebData(); } -WebString WebKitPlatformSupportImpl::queryLocalizedString( +WebString BlinkPlatformImpl::queryLocalizedString( WebLocalizedString::Name name) { int message_id = ToMessageID(name); if (message_id < 0) @@ -683,12 +683,12 @@ WebString WebKitPlatformSupportImpl::queryLocalizedString( return GetLocalizedString(message_id); } -WebString WebKitPlatformSupportImpl::queryLocalizedString( +WebString BlinkPlatformImpl::queryLocalizedString( WebLocalizedString::Name name, int numeric_value) { return queryLocalizedString(name, base::IntToString16(numeric_value)); } -WebString WebKitPlatformSupportImpl::queryLocalizedString( +WebString BlinkPlatformImpl::queryLocalizedString( WebLocalizedString::Name name, const WebString& value) { int message_id = ToMessageID(name); if (message_id < 0) @@ -696,7 +696,7 @@ WebString WebKitPlatformSupportImpl::queryLocalizedString( return ReplaceStringPlaceholders(GetLocalizedString(message_id), value, NULL); } -WebString WebKitPlatformSupportImpl::queryLocalizedString( +WebString BlinkPlatformImpl::queryLocalizedString( WebLocalizedString::Name name, const WebString& value1, const WebString& value2) { @@ -711,25 +711,25 @@ WebString WebKitPlatformSupportImpl::queryLocalizedString( GetLocalizedString(message_id), values, NULL); } -double WebKitPlatformSupportImpl::currentTime() { +double BlinkPlatformImpl::currentTime() { return base::Time::Now().ToDoubleT(); } -double WebKitPlatformSupportImpl::monotonicallyIncreasingTime() { +double BlinkPlatformImpl::monotonicallyIncreasingTime() { return base::TimeTicks::Now().ToInternalValue() / static_cast<double>(base::Time::kMicrosecondsPerSecond); } -void WebKitPlatformSupportImpl::cryptographicallyRandomValues( +void BlinkPlatformImpl::cryptographicallyRandomValues( unsigned char* buffer, size_t length) { base::RandBytes(buffer, length); } -void WebKitPlatformSupportImpl::setSharedTimerFiredFunction(void (*func)()) { +void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { shared_timer_func_ = func; } -void WebKitPlatformSupportImpl::setSharedTimerFireInterval( +void BlinkPlatformImpl::setSharedTimerFireInterval( double interval_seconds) { shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); if (shared_timer_suspended_) { @@ -756,45 +756,45 @@ void WebKitPlatformSupportImpl::setSharedTimerFireInterval( shared_timer_.Stop(); shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), - this, &WebKitPlatformSupportImpl::DoTimeout); + this, &BlinkPlatformImpl::DoTimeout); OnStartSharedTimer(base::TimeDelta::FromMicroseconds(interval)); } -void WebKitPlatformSupportImpl::stopSharedTimer() { +void BlinkPlatformImpl::stopSharedTimer() { shared_timer_.Stop(); } -void WebKitPlatformSupportImpl::callOnMainThread( +void BlinkPlatformImpl::callOnMainThread( void (*func)(void*), void* context) { main_loop_->PostTask(FROM_HERE, base::Bind(func, context)); } -base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile( +base::PlatformFile BlinkPlatformImpl::databaseOpenFile( const blink::WebString& vfs_file_name, int desired_flags) { return base::kInvalidPlatformFileValue; } -int WebKitPlatformSupportImpl::databaseDeleteFile( +int BlinkPlatformImpl::databaseDeleteFile( const blink::WebString& vfs_file_name, bool sync_dir) { return -1; } -long WebKitPlatformSupportImpl::databaseGetFileAttributes( +long BlinkPlatformImpl::databaseGetFileAttributes( const blink::WebString& vfs_file_name) { return 0; } -long long WebKitPlatformSupportImpl::databaseGetFileSize( +long long BlinkPlatformImpl::databaseGetFileSize( const blink::WebString& vfs_file_name) { return 0; } -long long WebKitPlatformSupportImpl::databaseGetSpaceAvailableForOrigin( +long long BlinkPlatformImpl::databaseGetSpaceAvailableForOrigin( const blink::WebString& origin_identifier) { return 0; } -blink::WebString WebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( +blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString( unsigned key_size_index, const blink::WebString& challenge, const blink::WebURL& url) { @@ -822,28 +822,28 @@ static size_t getMemoryUsageMB(bool bypass_cache) { mem_usage_cache_singleton->IsCachedValueValid(¤t_mem_usage)) return current_mem_usage; - current_mem_usage = MemoryUsageKB() >> 10; + current_mem_usage = webkit_glue::MemoryUsageKB() >> 10; mem_usage_cache_singleton->SetMemoryValue(current_mem_usage); return current_mem_usage; } -size_t WebKitPlatformSupportImpl::memoryUsageMB() { +size_t BlinkPlatformImpl::memoryUsageMB() { return getMemoryUsageMB(false); } -size_t WebKitPlatformSupportImpl::actualMemoryUsageMB() { +size_t BlinkPlatformImpl::actualMemoryUsageMB() { return getMemoryUsageMB(true); } -size_t WebKitPlatformSupportImpl::physicalMemoryMB() { +size_t BlinkPlatformImpl::physicalMemoryMB() { return static_cast<size_t>(base::SysInfo::AmountOfPhysicalMemoryMB()); } -size_t WebKitPlatformSupportImpl::numberOfProcessors() { +size_t BlinkPlatformImpl::numberOfProcessors() { return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); } -void WebKitPlatformSupportImpl::startHeapProfiling( +void BlinkPlatformImpl::startHeapProfiling( const blink::WebString& prefix) { // FIXME(morrita): Make this built on windows. #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) @@ -851,20 +851,20 @@ void WebKitPlatformSupportImpl::startHeapProfiling( #endif } -void WebKitPlatformSupportImpl::stopHeapProfiling() { +void BlinkPlatformImpl::stopHeapProfiling() { #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) HeapProfilerStop(); #endif } -void WebKitPlatformSupportImpl::dumpHeapProfiling( +void BlinkPlatformImpl::dumpHeapProfiling( const blink::WebString& reason) { #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) HeapProfilerDump(reason.utf8().data()); #endif } -WebString WebKitPlatformSupportImpl::getHeapProfile() { +WebString BlinkPlatformImpl::getHeapProfile() { #if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN) char* data = GetHeapProfile(); WebString result = WebString::fromUTF8(std::string(data)); @@ -875,17 +875,17 @@ WebString WebKitPlatformSupportImpl::getHeapProfile() { #endif } -bool WebKitPlatformSupportImpl::processMemorySizesInBytes( +bool BlinkPlatformImpl::processMemorySizesInBytes( size_t* private_bytes, size_t* shared_bytes) { return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes); } -bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) { +bool BlinkPlatformImpl::memoryAllocatorWasteInBytes(size_t* size) { return base::allocator::GetAllocatorWasteSize(size); } -size_t WebKitPlatformSupportImpl::maxDecodedImageBytes() { +size_t BlinkPlatformImpl::maxDecodedImageBytes() { #if defined(OS_ANDROID) if (base::android::SysUtils::IsLowEndDevice()) { // Limit image decoded size to 3M pixels on low end devices. @@ -900,11 +900,11 @@ size_t WebKitPlatformSupportImpl::maxDecodedImageBytes() { #endif } -void WebKitPlatformSupportImpl::SuspendSharedTimer() { +void BlinkPlatformImpl::SuspendSharedTimer() { ++shared_timer_suspended_; } -void WebKitPlatformSupportImpl::ResumeSharedTimer() { +void BlinkPlatformImpl::ResumeSharedTimer() { // The shared timer may have fired or been adjusted while we were suspended. if (--shared_timer_suspended_ == 0 && (!shared_timer_.IsRunning() || @@ -915,4 +915,4 @@ void WebKitPlatformSupportImpl::ResumeSharedTimer() { } } -} // namespace webkit_glue +} // namespace content diff --git a/webkit/child/webkitplatformsupport_impl.h b/content/child/blink_platform_impl.h index 6af5b78..944272a 100644 --- a/webkit/child/webkitplatformsupport_impl.h +++ b/content/child/blink_platform_impl.h @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_IMPL_H_ -#define WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_IMPL_H_ +#ifndef CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ +#define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ #include "base/compiler_specific.h" #include "base/debug/trace_event.h" #include "base/platform_file.h" #include "base/timer/timer.h" +#include "content/common/content_export.h" #include "third_party/WebKit/public/platform/Platform.h" #include "third_party/WebKit/public/platform/WebURLError.h" #include "ui/base/layout.h" #include "webkit/child/resource_loader_bridge.h" -#include "webkit/child/webkit_child_export.h" namespace base { class MessageLoop; @@ -23,16 +23,16 @@ namespace blink { class WebSocketStreamHandle; } -namespace webkit_glue { +namespace content { class WebSocketStreamHandleDelegate; class WebSocketStreamHandleBridge; -class WEBKIT_CHILD_EXPORT WebKitPlatformSupportImpl : - NON_EXPORTED_BASE(public blink::Platform) { +class CONTENT_EXPORT BlinkPlatformImpl + : NON_EXPORTED_BASE(public blink::Platform) { public: - WebKitPlatformSupportImpl(); - virtual ~WebKitPlatformSupportImpl(); + BlinkPlatformImpl(); + virtual ~BlinkPlatformImpl(); // Platform methods (partial implementation): virtual base::PlatformFile databaseOpenFile( @@ -126,8 +126,8 @@ class WEBKIT_CHILD_EXPORT WebKitPlatformSupportImpl : ui::ScaleFactor scale_factor) = 0; // Creates a ResourceLoaderBridge. - virtual ResourceLoaderBridge* CreateResourceLoader( - const ResourceLoaderBridge::RequestInfo& request_info) = 0; + virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) = 0; // Creates a WebSocketStreamHandleBridge. virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( blink::WebSocketStreamHandle* handle, @@ -144,13 +144,13 @@ class WEBKIT_CHILD_EXPORT WebKitPlatformSupportImpl : } base::MessageLoop* main_loop_; - base::OneShotTimer<WebKitPlatformSupportImpl> shared_timer_; + base::OneShotTimer<BlinkPlatformImpl> shared_timer_; void (*shared_timer_func_)(); double shared_timer_fire_time_; bool shared_timer_fire_time_was_set_while_suspended_; int shared_timer_suspended_; // counter }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_IMPL_H_ +#endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ diff --git a/content/child/blink_platform_unittest.cc b/content/child/blink_platform_unittest.cc index acd049c..c045b30 100644 --- a/content/child/blink_platform_unittest.cc +++ b/content/child/blink_platform_unittest.cc @@ -4,17 +4,17 @@ #include "base/run_loop.h" #include "base/time/time.h" +#include "content/child/blink_platform_impl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/child/webkitplatformsupport_impl.h" namespace content { -// Derives WebKitPlatformSupportImpl for testing shared timers. -class TestBlinkPlatformImpl : public webkit_glue::WebKitPlatformSupportImpl { +// Derives BlinkPlatformImpl for testing shared timers. +class TestBlinkPlatformImpl : public BlinkPlatformImpl { public: TestBlinkPlatformImpl() : mock_monotonically_increasing_time_(0) {} - // webkit_glue::WebKitPlatformSupportImpl: + // webkit_glue::BlinkPlatformImpl: virtual base::string16 GetLocalizedString(int) OVERRIDE { return base::string16(); } @@ -28,9 +28,9 @@ class TestBlinkPlatformImpl : public webkit_glue::WebKitPlatformSupportImpl { return NULL; } - virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( + virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( blink::WebSocketStreamHandle*, - webkit_glue::WebSocketStreamHandleDelegate*) OVERRIDE { + WebSocketStreamHandleDelegate*) OVERRIDE { return NULL; } @@ -38,8 +38,7 @@ class TestBlinkPlatformImpl : public webkit_glue::WebKitPlatformSupportImpl { virtual double monotonicallyIncreasingTime() OVERRIDE { if (mock_monotonically_increasing_time_ > 0.0) return mock_monotonically_increasing_time_; - return webkit_glue::WebKitPlatformSupportImpl:: - monotonicallyIncreasingTime(); + return BlinkPlatformImpl::monotonicallyIncreasingTime(); } virtual void OnStartSharedTimer(base::TimeDelta delay) OVERRIDE { diff --git a/content/child/database_util.h b/content/child/database_util.h index 284a147..8be607c 100644 --- a/content/child/database_util.h +++ b/content/child/database_util.h @@ -5,7 +5,7 @@ #ifndef CONTENT_CHILD_DATABASE_UTIL_H_ #define CONTENT_CHILD_DATABASE_UTIL_H_ -#include "webkit/child/webkitplatformsupport_impl.h" +#include "content/child/blink_platform_impl.h" namespace IPC { class SyncMessageFilter; diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc index 6ff7e8a..1ea09ed 100644 --- a/content/child/npapi/plugin_url_fetcher.cc +++ b/content/child/npapi/plugin_url_fetcher.cc @@ -6,21 +6,21 @@ #include "base/memory/scoped_ptr.h" #include "content/child/child_thread.h" -#include "content/child/npapi/webplugin.h" #include "content/child/npapi/plugin_host.h" #include "content/child/npapi/plugin_instance.h" #include "content/child/npapi/plugin_stream_url.h" +#include "content/child/npapi/webplugin.h" #include "content/child/npapi/webplugin_resource_client.h" #include "content/child/plugin_messages.h" #include "content/child/request_extra_data.h" #include "content/child/resource_dispatcher.h" +#include "content/child/web_url_loader_impl.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" #include "webkit/child/multipart_response_delegate.h" -#include "webkit/child/weburlloader_impl.h" #include "webkit/common/resource_request_body.h" namespace content { @@ -236,7 +236,7 @@ void PluginURLFetcher::OnReceivedResponse( if (response_code == 206) { blink::WebURLResponse response; response.initialize(); - webkit_glue::WebURLLoaderImpl::PopulateURLResponse(url_, info, &response); + WebURLLoaderImpl::PopulateURLResponse(url_, info, &response); std::string multipart_boundary; if (webkit_glue::MultipartResponseDelegate::ReadMultipartBoundary( diff --git a/content/child/socket_stream_dispatcher.cc b/content/child/socket_stream_dispatcher.cc index cdc0845..017a116 100644 --- a/content/child/socket_stream_dispatcher.cc +++ b/content/child/socket_stream_dispatcher.cc @@ -14,32 +14,29 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "content/child/child_thread.h" +#include "content/child/web_socket_stream_handle_bridge.h" +#include "content/child/web_socket_stream_handle_delegate.h" +#include "content/child/web_socket_stream_handle_impl.h" #include "content/common/socket_stream.h" #include "content/common/socket_stream_handle_data.h" #include "content/common/socket_stream_messages.h" #include "net/base/net_errors.h" #include "url/gurl.h" -#include "webkit/child/websocketstreamhandle_bridge.h" -#include "webkit/child/websocketstreamhandle_delegate.h" namespace content { // IPCWebSocketStreamHandleBridge is owned by each SocketStreamHandle. // It communicates with the main browser process via SocketStreamDispatcher. -class IPCWebSocketStreamHandleBridge - : public webkit_glue::WebSocketStreamHandleBridge { +class IPCWebSocketStreamHandleBridge : public WebSocketStreamHandleBridge { public: - IPCWebSocketStreamHandleBridge( - blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) - : socket_id_(kNoSocketId), - handle_(handle), - delegate_(delegate) {} + IPCWebSocketStreamHandleBridge(blink::WebSocketStreamHandle* handle, + WebSocketStreamHandleDelegate* delegate) + : socket_id_(kNoSocketId), handle_(handle), delegate_(delegate) {} // Returns the handle having given id or NULL if there is no such handle. static IPCWebSocketStreamHandleBridge* FromSocketId(int id); - // webkit_glue::WebSocketStreamHandleBridge methods. + // WebSocketStreamHandleBridge methods. virtual void Connect(const GURL& url) OVERRIDE; virtual bool Send(const std::vector<char>& data) OVERRIDE; virtual void Close() OVERRIDE; @@ -59,7 +56,7 @@ class IPCWebSocketStreamHandleBridge int socket_id_; blink::WebSocketStreamHandle* handle_; - webkit_glue::WebSocketStreamHandleDelegate* delegate_; + WebSocketStreamHandleDelegate* delegate_; // Map from ID to bridge instance. static base::LazyInstance<IDMap<IPCWebSocketStreamHandleBridge> >::Leaky @@ -97,8 +94,10 @@ void IPCWebSocketStreamHandleBridge::Connect(const GURL& url) { socket_id_ = all_bridges.Get().Add(this); DCHECK_NE(socket_id_, kNoSocketId); int render_frame_id = MSG_ROUTING_NONE; + WebSocketStreamHandleImpl* impl = + static_cast<WebSocketStreamHandleImpl*>(handle_); const SocketStreamHandleData* data = - SocketStreamHandleData::ForHandle(handle_); + static_cast<SocketStreamHandleData*>(impl->GetUserData(handle_)); if (data) render_frame_id = data->render_frame_id(); AddRef(); // Released in OnClosed(). @@ -174,11 +173,10 @@ void IPCWebSocketStreamHandleBridge::OnFailed(int error_code, SocketStreamDispatcher::SocketStreamDispatcher() { } -/* static */ -webkit_glue::WebSocketStreamHandleBridge* -SocketStreamDispatcher::CreateBridge( +// static +WebSocketStreamHandleBridge* SocketStreamDispatcher::CreateBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) { + WebSocketStreamHandleDelegate* delegate) { return new IPCWebSocketStreamHandleBridge(handle, delegate); } diff --git a/content/child/socket_stream_dispatcher.h b/content/child/socket_stream_dispatcher.h index a52907a..25596005 100644 --- a/content/child/socket_stream_dispatcher.h +++ b/content/child/socket_stream_dispatcher.h @@ -15,12 +15,10 @@ namespace blink { class WebSocketStreamHandle; } -namespace webkit_glue { +namespace content { + class WebSocketStreamHandleBridge; class WebSocketStreamHandleDelegate; -} - -namespace content { // Dispatches socket stream related messages sent to a child process from the // main browser process. There is one instance per child process. Messages @@ -31,9 +29,9 @@ class SocketStreamDispatcher : public IPC::Listener { SocketStreamDispatcher(); virtual ~SocketStreamDispatcher() {} - static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( + static WebSocketStreamHandleBridge* CreateBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate); + WebSocketStreamHandleDelegate* delegate); // IPC::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; diff --git a/webkit/child/websocketstreamhandle_bridge.h b/content/child/web_socket_stream_handle_bridge.h index f66afd2..2655c10 100644 --- a/webkit/child/websocketstreamhandle_bridge.h +++ b/content/child/web_socket_stream_handle_bridge.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_BRIDGE_H_ -#define WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_BRIDGE_H_ +#ifndef CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_BRIDGE_H_ +#define CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_BRIDGE_H_ #include <vector> @@ -12,7 +12,7 @@ class GURL; -namespace webkit_glue { +namespace content { class WebSocketStreamHandleBridge : public base::RefCountedThreadSafe<WebSocketStreamHandleBridge> { @@ -32,6 +32,6 @@ class WebSocketStreamHandleBridge DISALLOW_COPY_AND_ASSIGN(WebSocketStreamHandleBridge); }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_BRIDGE_H_ +#endif // CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_BRIDGE_H_ diff --git a/webkit/child/websocketstreamhandle_delegate.h b/content/child/web_socket_stream_handle_delegate.h index 16d15a0..f7243637 100644 --- a/webkit/child/websocketstreamhandle_delegate.h +++ b/content/child/web_socket_stream_handle_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_DELEGATE_H_ -#define WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_DELEGATE_H_ +#ifndef CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_DELEGATE_H_ +#define CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_DELEGATE_H_ #include "base/strings/string16.h" @@ -13,7 +13,7 @@ namespace blink { class WebSocketStreamHandle; } -namespace webkit_glue { +namespace content { class WebSocketStreamHandleDelegate { public: @@ -39,6 +39,6 @@ class WebSocketStreamHandleDelegate { virtual ~WebSocketStreamHandleDelegate() {} }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_DELEGATE_H_ +#endif // CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_DELEGATE_H_ diff --git a/webkit/child/websocketstreamhandle_impl.cc b/content/child/web_socket_stream_handle_impl.cc index 761749f..29152ec 100644 --- a/webkit/child/websocketstreamhandle_impl.cc +++ b/content/child/web_socket_stream_handle_impl.cc @@ -4,7 +4,7 @@ // An implementation of WebSocketStreamHandle. -#include "webkit/child/websocketstreamhandle_impl.h" +#include "content/child/web_socket_stream_handle_impl.h" #include <vector> @@ -13,13 +13,13 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" +#include "content/child/blink_platform_impl.h" +#include "content/child/web_socket_stream_handle_bridge.h" +#include "content/child/web_socket_stream_handle_delegate.h" #include "third_party/WebKit/public/platform/WebData.h" #include "third_party/WebKit/public/platform/WebSocketStreamError.h" #include "third_party/WebKit/public/platform/WebSocketStreamHandleClient.h" #include "third_party/WebKit/public/platform/WebURL.h" -#include "webkit/child/webkitplatformsupport_impl.h" -#include "webkit/child/websocketstreamhandle_bridge.h" -#include "webkit/child/websocketstreamhandle_delegate.h" using blink::WebData; using blink::WebSocketStreamError; @@ -27,7 +27,7 @@ using blink::WebSocketStreamHandle; using blink::WebSocketStreamHandleClient; using blink::WebURL; -namespace webkit_glue { +namespace content { // WebSocketStreamHandleImpl::Context ----------------------------------------- @@ -42,7 +42,7 @@ class WebSocketStreamHandleImpl::Context client_ = client; } - void Connect(const WebURL& url, WebKitPlatformSupportImpl* platform); + void Connect(const WebURL& url, BlinkPlatformImpl* platform); bool Send(const WebData& data); void Close(); @@ -83,9 +83,8 @@ WebSocketStreamHandleImpl::Context::Context(WebSocketStreamHandleImpl* handle) client_(NULL) { } -void WebSocketStreamHandleImpl::Context::Connect( - const WebURL& url, - WebKitPlatformSupportImpl* platform) { +void WebSocketStreamHandleImpl::Context::Connect(const WebURL& url, + BlinkPlatformImpl* platform) { VLOG(1) << "Connect url=" << url; DCHECK(!bridge_.get()); bridge_ = platform->CreateWebSocketStreamBridge(handle_, this); @@ -165,7 +164,7 @@ void WebSocketStreamHandleImpl::Context::DidFail( // WebSocketStreamHandleImpl ------------------------------------------------ WebSocketStreamHandleImpl::WebSocketStreamHandleImpl( - WebKitPlatformSupportImpl* platform) + BlinkPlatformImpl* platform) : context_(new Context(this)), platform_(platform) { } @@ -194,4 +193,4 @@ void WebSocketStreamHandleImpl::close() { context_->Close(); } -} // namespace webkit_glue +} // namespace content diff --git a/webkit/child/websocketstreamhandle_impl.h b/content/child/web_socket_stream_handle_impl.h index c2f7f31..6e80676 100644 --- a/webkit/child/websocketstreamhandle_impl.h +++ b/content/child/web_socket_stream_handle_impl.h @@ -2,39 +2,37 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_IMPL_H_ -#define WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_IMPL_H_ +#ifndef CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_IMPL_H_ +#define CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_IMPL_H_ #include "base/memory/ref_counted.h" #include "base/supports_user_data.h" #include "third_party/WebKit/public/platform/WebSocketStreamHandle.h" -namespace webkit_glue { +namespace content { -class WebKitPlatformSupportImpl; +class BlinkPlatformImpl; -class WebSocketStreamHandleImpl - : public base::SupportsUserData, - public blink::WebSocketStreamHandle { +class WebSocketStreamHandleImpl : public base::SupportsUserData, + public blink::WebSocketStreamHandle { public: - explicit WebSocketStreamHandleImpl(WebKitPlatformSupportImpl* platform); + explicit WebSocketStreamHandleImpl(BlinkPlatformImpl* platform); virtual ~WebSocketStreamHandleImpl(); // WebSocketStreamHandle methods: - virtual void connect( - const blink::WebURL& url, - blink::WebSocketStreamHandleClient* client); + virtual void connect(const blink::WebURL& url, + blink::WebSocketStreamHandleClient* client); virtual bool send(const blink::WebData& data); virtual void close(); private: class Context; scoped_refptr<Context> context_; - WebKitPlatformSupportImpl* platform_; + BlinkPlatformImpl* platform_; DISALLOW_COPY_AND_ASSIGN(WebSocketStreamHandleImpl); }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_CHILD_WEBSOCKETSTREAMHANDLE_IMPL_H_ +#endif // CONTENT_CHILD_WEB_SOCKET_STREAM_HANDLE_IMPL_H_ diff --git a/webkit/child/weburlloader_impl.cc b/content/child/web_url_loader_impl.cc index 7e5a8ad..b7ff109 100644 --- a/webkit/child/weburlloader_impl.cc +++ b/content/child/web_url_loader_impl.cc @@ -4,7 +4,7 @@ // An implementation of WebURLLoader in terms of ResourceLoaderBridge. -#include "webkit/child/weburlloader_impl.h" +#include "content/child/web_url_loader_impl.h" #include "base/bind.h" #include "base/files/file_path.h" @@ -12,6 +12,7 @@ #include "base/message_loop/message_loop.h" #include "base/strings/string_util.h" #include "base/time/time.h" +#include "content/child/blink_platform_impl.h" #include "net/base/data_url.h" #include "net/base/load_flags.h" #include "net/base/mime_util.h" @@ -32,7 +33,6 @@ #include "webkit/child/ftp_directory_listing_response_delegate.h" #include "webkit/child/multipart_response_delegate.h" #include "webkit/child/resource_loader_bridge.h" -#include "webkit/child/webkitplatformsupport_impl.h" #include "webkit/child/weburlrequest_extradata_impl.h" #include "webkit/child/weburlresponse_extradata_impl.h" #include "webkit/common/resource_request_body.h" @@ -53,8 +53,15 @@ using blink::WebURLLoader; using blink::WebURLLoaderClient; using blink::WebURLRequest; using blink::WebURLResponse; +using webkit_glue::FtpDirectoryListingResponseDelegate; +using webkit_glue::MultipartResponseDelegate; +using webkit_glue::ResourceDevToolsInfo; +using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceRequestBody; +using webkit_glue::ResourceResponseInfo; +using webkit_glue::WebURLResponseExtraDataImpl; -namespace webkit_glue { +namespace content { // Utilities ------------------------------------------------------------------ @@ -224,10 +231,9 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, void Cancel(); void SetDefersLoading(bool value); void DidChangePriority(WebURLRequest::Priority new_priority); - void Start( - const WebURLRequest& request, - ResourceLoaderBridge::SyncLoadResponse* sync_load_response, - WebKitPlatformSupportImpl* platform); + void Start(const WebURLRequest& request, + ResourceLoaderBridge::SyncLoadResponse* sync_load_response, + BlinkPlatformImpl* platform); // ResourceLoaderBridge::Peer methods: virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; @@ -305,7 +311,7 @@ void WebURLLoaderImpl::Context::DidChangePriority( void WebURLLoaderImpl::Context::Start( const WebURLRequest& request, ResourceLoaderBridge::SyncLoadResponse* sync_load_response, - WebKitPlatformSupportImpl* platform) { + BlinkPlatformImpl* platform) { DCHECK(!bridge_.get()); request_ = request; // Save the request. @@ -685,7 +691,7 @@ void WebURLLoaderImpl::Context::HandleDataURL() { // WebURLLoaderImpl ----------------------------------------------------------- -WebURLLoaderImpl::WebURLLoaderImpl(WebKitPlatformSupportImpl* platform) +WebURLLoaderImpl::WebURLLoaderImpl(BlinkPlatformImpl* platform) : context_(new Context(this)), platform_(platform) { } @@ -868,4 +874,4 @@ void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { context_->DidChangePriority(new_priority); } -} // namespace webkit_glue +} // namespace content diff --git a/webkit/child/weburlloader_impl.h b/content/child/web_url_loader_impl.h index 3c69923..7b31358 100644 --- a/webkit/child/weburlloader_impl.h +++ b/content/child/web_url_loader_impl.h @@ -2,29 +2,32 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_CHILD_WEBURLLOADER_IMPL_H_ -#define WEBKIT_CHILD_WEBURLLOADER_IMPL_H_ +#ifndef CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ +#define CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ #include "base/memory/ref_counted.h" +#include "content/common/content_export.h" #include "third_party/WebKit/public/platform/WebURLLoader.h" -#include "webkit/child/webkit_child_export.h" namespace webkit_glue { - -class WebKitPlatformSupportImpl; struct ResourceResponseInfo; +} + +namespace content { + +class BlinkPlatformImpl; class WebURLLoaderImpl : public blink::WebURLLoader { public: - explicit WebURLLoaderImpl(WebKitPlatformSupportImpl* platform); + explicit WebURLLoaderImpl(BlinkPlatformImpl* platform); virtual ~WebURLLoaderImpl(); static blink::WebURLError CreateError(const blink::WebURL& unreachable_url, bool stale_copy_in_cache, int reason); - WEBKIT_CHILD_EXPORT static void PopulateURLResponse( + CONTENT_EXPORT static void PopulateURLResponse( const GURL& url, - const ResourceResponseInfo& info, + const webkit_glue::ResourceResponseInfo& info, blink::WebURLResponse* response); // WebURLLoader methods: @@ -43,9 +46,9 @@ class WebURLLoaderImpl : public blink::WebURLLoader { private: class Context; scoped_refptr<Context> context_; - WebKitPlatformSupportImpl* platform_; + BlinkPlatformImpl* platform_; }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_CHILD_WEBURLLOADER_IMPL_H_ +#endif // CONTENT_CHILD_WEB_URL_LOADER_IMPL_H_ diff --git a/content/child/webkitplatformsupport_child_impl.h b/content/child/webkitplatformsupport_child_impl.h index 3093ec1..91bf191 100644 --- a/content/child/webkitplatformsupport_child_impl.h +++ b/content/child/webkitplatformsupport_child_impl.h @@ -6,10 +6,9 @@ #define CONTENT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_ #include "base/threading/thread_local_storage.h" +#include "content/child/blink_platform_impl.h" #include "content/child/webfallbackthemeengine_impl.h" #include "content/common/content_export.h" -#include "webkit/child/webkit_child_export.h" -#include "webkit/child/webkitplatformsupport_impl.h" #if defined(USE_DEFAULT_RENDER_THEME) #include "content/child/webthemeengine_impl_default.h" @@ -25,8 +24,7 @@ namespace content { class FlingCurveConfiguration; -class CONTENT_EXPORT WebKitPlatformSupportChildImpl : - public webkit_glue::WebKitPlatformSupportImpl { +class CONTENT_EXPORT WebKitPlatformSupportChildImpl : public BlinkPlatformImpl { public: WebKitPlatformSupportChildImpl(); virtual ~WebKitPlatformSupportChildImpl(); diff --git a/content/child/webkitplatformsupport_impl.cc b/content/child/webkitplatformsupport_impl.cc index 5b8cc79..13b2603 100644 --- a/content/child/webkitplatformsupport_impl.cc +++ b/content/child/webkitplatformsupport_impl.cc @@ -33,10 +33,10 @@ WebKitPlatformSupportImpl::CreateResourceLoader( return ChildThread::current()->CreateBridge(request_info); } -webkit_glue::WebSocketStreamHandleBridge* +WebSocketStreamHandleBridge* WebKitPlatformSupportImpl::CreateWebSocketStreamBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) { + WebSocketStreamHandleDelegate* delegate) { SocketStreamDispatcher* dispatcher = ChildThread::current()->socket_stream_dispatcher(); return dispatcher->CreateBridge(handle, delegate); diff --git a/content/child/webkitplatformsupport_impl.h b/content/child/webkitplatformsupport_impl.h index a233125..001d27f 100644 --- a/content/child/webkitplatformsupport_impl.h +++ b/content/child/webkitplatformsupport_impl.h @@ -29,9 +29,9 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) OVERRIDE; - virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( + virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; + WebSocketStreamHandleDelegate* delegate) OVERRIDE; virtual blink::WebSocketHandle* createWebSocketHandle() OVERRIDE; }; diff --git a/content/common/DEPS b/content/common/DEPS index b26b7a4..9e5bef7 100644 --- a/content/common/DEPS +++ b/content/common/DEPS @@ -5,9 +5,6 @@ include_rules = [ "-webkit/child", "-webkit/renderer", - # TODO(ananta|jamesr|scottmg) http://crbug.com/237249 - "!webkit/child/websocketstreamhandle_impl.h", - # No inclusion of WebKit from the browser, other than strictly enum/POD, # header-only types, and some selected common code. "-third_party/WebKit", diff --git a/content/common/socket_stream_handle_data.cc b/content/common/socket_stream_handle_data.cc deleted file mode 100644 index 04f66ef..0000000 --- a/content/common/socket_stream_handle_data.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/socket_stream_handle_data.h" - -#include "webkit/child/websocketstreamhandle_impl.h" - -using webkit_glue::WebSocketStreamHandleImpl; -using blink::WebSocketStreamHandle; - -namespace content { - -// static -void SocketStreamHandleData::AddToHandle( - WebSocketStreamHandle* handle, int render_frame_id) { - if (!handle) { - NOTREACHED(); - return; - } - WebSocketStreamHandleImpl* impl = - static_cast<WebSocketStreamHandleImpl*>(handle); - impl->SetUserData(handle, new SocketStreamHandleData(render_frame_id)); -} - -// static -const SocketStreamHandleData* SocketStreamHandleData::ForHandle( - WebSocketStreamHandle* handle) { - if (!handle) - return NULL; - WebSocketStreamHandleImpl* impl = - static_cast<WebSocketStreamHandleImpl*>(handle); - return static_cast<SocketStreamHandleData*>(impl->GetUserData(handle)); -} - -} // namespace content diff --git a/content/common/socket_stream_handle_data.h b/content/common/socket_stream_handle_data.h index 113f889..3ce79ca 100644 --- a/content/common/socket_stream_handle_data.h +++ b/content/common/socket_stream_handle_data.h @@ -6,36 +6,20 @@ #define CONTENT_RENDERER_SOCKET_STREAM_HANDLE_DATA_H_ #include "base/supports_user_data.h" -#include "content_export.h" - -namespace blink { -class WebSocketStreamHandle; -} +#include "content/common/content_export.h" namespace content { // User data stored in each WebSocketStreamHandleImpl. class SocketStreamHandleData : public base::SupportsUserData::Data { public: + explicit SocketStreamHandleData(int render_frame_id) + : render_frame_id_(render_frame_id) {} virtual ~SocketStreamHandleData() {} int render_frame_id() const { return render_frame_id_; } - // Creates SocketStreamHandleData object with |render_frame_id| and store it - // to |handle|. - static void AddToHandle( - blink::WebSocketStreamHandle* handle, int render_frame_id); - - // Retrieves the stored user data from blink::WebSocketStreamHandle object. - // |handle| must actually be a WebSocketStreamHandleImpl object. - CONTENT_EXPORT static const SocketStreamHandleData* ForHandle( - blink::WebSocketStreamHandle* handle); - private: - explicit SocketStreamHandleData(int render_frame_id) - : render_frame_id_(render_frame_id) { - } - int render_frame_id_; DISALLOW_COPY_AND_ASSIGN(SocketStreamHandleData); diff --git a/content/content_child.gypi b/content/content_child.gypi index bb8546d..45d9fe8 100644 --- a/content/content_child.gypi +++ b/content/content_child.gypi @@ -29,6 +29,8 @@ 'child/appcache/web_application_cache_host_impl.h', 'child/blink_glue.cc', 'child/blink_glue.h', + 'child/blink_platform_impl.cc', + 'child/blink_platform_impl.h', 'child/browser_font_resource_trusted.cc', 'child/browser_font_resource_trusted.h', 'child/child_histogram_message_filter.cc', @@ -155,8 +157,16 @@ 'child/web_database_observer_impl.h', 'child/web_discardable_memory_impl.cc', 'child/web_discardable_memory_impl.h', + 'child/web_socket_stream_handle_bridge.h', + 'child/web_socket_stream_handle_delegate.h', + 'child/web_socket_stream_handle_impl.cc', + 'child/web_socket_stream_handle_impl.h', + 'child/web_url_loader_impl.cc', + 'child/web_url_loader_impl.h', 'child/webblobregistry_impl.cc', 'child/webblobregistry_impl.h', + 'child/webfallbackthemeengine_impl.cc', + 'child/webfallbackthemeengine_impl.h', 'child/webfileutilities_impl.cc', 'child/webfileutilities_impl.h', 'child/webkitplatformsupport_child_impl.cc', @@ -169,8 +179,6 @@ 'child/websocket_bridge.h', 'child/websocket_dispatcher.cc', 'child/websocket_dispatcher.h', - 'child/webfallbackthemeengine_impl.cc', - 'child/webfallbackthemeengine_impl.h', 'child/webthemeengine_impl_android.cc', 'child/webthemeengine_impl_android.h', 'child/webthemeengine_impl_default.cc', @@ -221,6 +229,7 @@ '../third_party/npapi/npapi.gyp:npapi', '../webkit/child/webkit_child.gyp:webkit_child', '../webkit/common/webkit_common.gyp:webkit_common', + '../webkit/webkit_resources.gyp:webkit_resources', ], }], ['use_aura==1', { diff --git a/content/content_common.gypi b/content/content_common.gypi index a9ade95..fe233e3 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -385,7 +385,6 @@ 'common/set_process_title_linux.cc', 'common/set_process_title_linux.h', 'common/socket_stream.h', - 'common/socket_stream_handle_data.cc', 'common/socket_stream_handle_data.h', 'common/socket_stream_messages.h', 'common/speech_recognition_messages.h', diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 4f5d19d..aa6645b 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -21,6 +21,7 @@ #include "content/child/quota_dispatcher.h" #include "content/child/request_extra_data.h" #include "content/child/service_worker/web_service_worker_provider_impl.h" +#include "content/child/web_socket_stream_handle_impl.h" #include "content/common/frame_messages.h" #include "content/common/socket_stream_handle_data.h" #include "content/common/swapped_out_messages.h" @@ -1993,7 +1994,9 @@ void RenderFrameImpl::requestStorageQuota( void RenderFrameImpl::willOpenSocketStream( blink::WebSocketStreamHandle* handle) { - SocketStreamHandleData::AddToHandle(handle, routing_id_); + WebSocketStreamHandleImpl* impl = + static_cast<WebSocketStreamHandleImpl*>(handle); + impl->SetUserData(handle, new SocketStreamHandleData(routing_id_)); } void RenderFrameImpl::willStartUsingPeerConnectionHandler( diff --git a/content/test/test_webkit_platform_support.cc b/content/test/test_webkit_platform_support.cc index cc97f28..fcdc606 100644 --- a/content/test/test_webkit_platform_support.cc +++ b/content/test/test_webkit_platform_support.cc @@ -11,6 +11,7 @@ #include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" +#include "content/child/blink_platform_impl.h" #include "content/public/common/content_switches.h" #include "content/test/mock_webclipboard_impl.h" #include "content/test/web_gesture_curve_mock.h" @@ -32,7 +33,6 @@ #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" #include "v8/include/v8.h" #include "webkit/browser/database/vfs_backend.h" -#include "webkit/child/webkitplatformsupport_impl.h" #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h" #if defined(OS_MACOSX) @@ -123,7 +123,7 @@ blink::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { blink::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() { return url_loader_factory_->CreateURLLoader( - webkit_glue::WebKitPlatformSupportImpl::createURLLoader()); + BlinkPlatformImpl::createURLLoader()); } blink::WebData TestWebKitPlatformSupport::loadResource(const char* name) { @@ -143,7 +143,7 @@ blink::WebData TestWebKitPlatformSupport::loadResource(const char* name) { "\x82"; return blink::WebData(red_square, arraysize(red_square)); } - return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); + return BlinkPlatformImpl::loadResource(name); } blink::WebString TestWebKitPlatformSupport::queryLocalizedString( @@ -169,7 +169,7 @@ blink::WebString TestWebKitPlatformSupport::queryLocalizedString( case blink::WebLocalizedString::WeekFormatTemplate: return base::ASCIIToUTF16("Week $2, $1"); default: - return WebKitPlatformSupportImpl::queryLocalizedString(name); + return BlinkPlatformImpl::queryLocalizedString(name); } } @@ -180,7 +180,7 @@ blink::WebString TestWebKitPlatformSupport::queryLocalizedString( return base::ASCIIToUTF16("range underflow"); if (name == blink::WebLocalizedString::ValidationRangeOverflow) return base::ASCIIToUTF16("range overflow"); - return WebKitPlatformSupportImpl::queryLocalizedString(name, value); + return BlinkPlatformImpl::queryLocalizedString(name, value); } blink::WebString TestWebKitPlatformSupport::queryLocalizedString( @@ -191,7 +191,7 @@ blink::WebString TestWebKitPlatformSupport::queryLocalizedString( return base::ASCIIToUTF16("too long"); if (name == blink::WebLocalizedString::ValidationStepMismatch) return base::ASCIIToUTF16("step mismatch"); - return WebKitPlatformSupportImpl::queryLocalizedString(name, value1, value2); + return BlinkPlatformImpl::queryLocalizedString(name, value1, value2); } blink::WebString TestWebKitPlatformSupport::defaultLocale() { @@ -230,10 +230,10 @@ TestWebKitPlatformSupport::CreateResourceLoader( return NULL; } -webkit_glue::WebSocketStreamHandleBridge* +WebSocketStreamHandleBridge* TestWebKitPlatformSupport::CreateWebSocketStreamBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) { + WebSocketStreamHandleDelegate* delegate) { NOTREACHED(); return NULL; } diff --git a/content/test/test_webkit_platform_support.h b/content/test/test_webkit_platform_support.h index 1dfb906..57568a4 100644 --- a/content/test/test_webkit_platform_support.h +++ b/content/test/test_webkit_platform_support.h @@ -69,9 +69,9 @@ class TestWebKitPlatformSupport virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) OVERRIDE; - virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( + virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( blink::WebSocketStreamHandle* handle, - webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE; + WebSocketStreamHandleDelegate* delegate) OVERRIDE; virtual blink::WebGestureCurve* createFlingAnimationCurve( int device_source, diff --git a/webkit/child/ftp_directory_listing_response_delegate.h b/webkit/child/ftp_directory_listing_response_delegate.h index 254ca80..af18f38 100644 --- a/webkit/child/ftp_directory_listing_response_delegate.h +++ b/webkit/child/ftp_directory_listing_response_delegate.h @@ -12,6 +12,7 @@ #include "base/basictypes.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" +#include "webkit/child/webkit_child_export.h" namespace blink { class WebURLLoader; @@ -22,7 +23,7 @@ class GURL; namespace webkit_glue { -class FtpDirectoryListingResponseDelegate { +class WEBKIT_CHILD_EXPORT FtpDirectoryListingResponseDelegate { public: FtpDirectoryListingResponseDelegate(blink::WebURLLoaderClient* client, blink::WebURLLoader* loader, diff --git a/webkit/child/webkit_child.gyp b/webkit/child/webkit_child.gyp index 6183b7b..cf341e52 100644 --- a/webkit/child/webkit_child.gyp +++ b/webkit/child/webkit_child.gyp @@ -67,14 +67,6 @@ 'webkit_child_export.h', 'webkit_child_helpers.cc', 'webkit_child_helpers.h', - 'webkitplatformsupport_impl.cc', - 'webkitplatformsupport_impl.h', - 'websocketstreamhandle_bridge.h', - 'websocketstreamhandle_delegate.h', - 'websocketstreamhandle_impl.cc', - 'websocketstreamhandle_impl.h', - 'weburlloader_impl.cc', - 'weburlloader_impl.h', 'weburlrequest_extradata_impl.cc', 'weburlrequest_extradata_impl.h', 'weburlresponse_extradata_impl.cc', |