Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / renderer / renderer_webkitplatformsupport_impl.cc
index daf4827..a92c3ae 100644 (file)
 #include "base/memory/shared_memory.h"
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/metrics/histogram.h"
+#include "base/numerics/safe_conversions.h"
 #include "base/platform_file.h"
-#include "base/safe_numerics.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
+#include "content/child/blink_glue.h"
 #include "content/child/database_util.h"
 #include "content/child/fileapi/webfilesystem_impl.h"
-#include "content/child/indexed_db/proxy_webidbfactory_impl.h"
+#include "content/child/indexed_db/webidbfactory_impl.h"
 #include "content/child/npapi/npobject_util.h"
 #include "content/child/quota_dispatcher.h"
 #include "content/child/quota_message_filter.h"
+#include "content/child/simple_webmimeregistry_impl.h"
 #include "content/child/thread_safe_sender.h"
+#include "content/child/web_database_observer_impl.h"
 #include "content/child/webblobregistry_impl.h"
+#include "content/child/webfileutilities_impl.h"
 #include "content/child/webmessageportchannel_impl.h"
 #include "content/common/file_utilities_messages.h"
 #include "content/common/gpu/client/context_provider_command_buffer.h"
@@ -47,6 +51,8 @@
 #include "content/renderer/renderer_clipboard_client.h"
 #include "content/renderer/webclipboard_impl.h"
 #include "content/renderer/webcrypto/webcrypto_impl.h"
+#include "content/renderer/webgraphicscontext3d_provider_impl.h"
+#include "content/renderer/webpublicsuffixlist_impl.h"
 #include "gpu/config/gpu_info.h"
 #include "ipc/ipc_sync_message_filter.h"
 #include "media/audio/audio_output_device.h"
 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
 #include "third_party/WebKit/public/platform/WebURL.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
+#include "ui/gfx/color_profile.h"
 #include "url/gurl.h"
-#include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h"
+#include "webkit/common/gpu/context_provider_web_context.h"
 #include "webkit/common/quota/quota_types.h"
-#include "webkit/glue/simple_webmimeregistry_impl.h"
-#include "webkit/glue/webfileutilities_impl.h"
-#include "webkit/glue/webkit_glue.h"
 
 #if defined(OS_WIN)
 #include "content/common/child_process_messages.h"
 #include "content/renderer/media/android/audio_decoder_android.h"
 #endif
 
-using WebKit::WebAudioDevice;
-using WebKit::WebBlobRegistry;
-using WebKit::WebFileInfo;
-using WebKit::WebFileSystem;
-using WebKit::WebFrame;
-using WebKit::WebGamepads;
-using WebKit::WebIDBFactory;
-using WebKit::WebMIDIAccessor;
-using WebKit::Platform;
-using WebKit::WebMediaStreamCenter;
-using WebKit::WebMediaStreamCenterClient;
-using WebKit::WebMimeRegistry;
-using WebKit::WebRTCPeerConnectionHandler;
-using WebKit::WebRTCPeerConnectionHandlerClient;
-using WebKit::WebStorageNamespace;
-using WebKit::WebString;
-using WebKit::WebURL;
-using WebKit::WebVector;
+using blink::Platform;
+using blink::WebAudioDevice;
+using blink::WebBlobRegistry;
+using blink::WebDatabaseObserver;
+using blink::WebFileInfo;
+using blink::WebFileSystem;
+using blink::WebGamepads;
+using blink::WebIDBFactory;
+using blink::WebMIDIAccessor;
+using blink::WebMediaStreamCenter;
+using blink::WebMediaStreamCenterClient;
+using blink::WebMimeRegistry;
+using blink::WebRTCPeerConnectionHandler;
+using blink::WebRTCPeerConnectionHandlerClient;
+using blink::WebStorageNamespace;
+using blink::WebString;
+using blink::WebURL;
+using blink::WebVector;
 
 namespace content {
 
 static bool g_sandbox_enabled = true;
 base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
     LAZY_INSTANCE_INITIALIZER;
-base::LazyInstance<WebKit::WebDeviceMotionData>::Leaky
+base::LazyInstance<blink::WebDeviceMotionData>::Leaky
     g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
-base::LazyInstance<WebKit::WebDeviceOrientationData>::Leaky
+base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
     g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER;
 
 //------------------------------------------------------------------------------
 
 class RendererWebKitPlatformSupportImpl::MimeRegistry
-    : public webkit_glue::SimpleWebMimeRegistryImpl {
+    : public SimpleWebMimeRegistryImpl {
  public:
-  virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
-      const WebKit::WebString& mime_type,
-      const WebKit::WebString& codecs,
-      const WebKit::WebString& key_system);
-  virtual bool supportsMediaSourceMIMEType(const WebKit::WebString& mime_type,
-                                           const WebKit::WebString& codecs);
-  virtual WebKit::WebString mimeTypeForExtension(
-      const WebKit::WebString& file_extension);
-  virtual WebKit::WebString mimeTypeFromFile(
-      const WebKit::WebString& file_path);
+  virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType(
+      const blink::WebString& mime_type,
+      const blink::WebString& codecs,
+      const blink::WebString& key_system);
+  virtual bool supportsMediaSourceMIMEType(const blink::WebString& mime_type,
+                                           const blink::WebString& codecs);
+  virtual blink::WebString mimeTypeForExtension(
+      const blink::WebString& file_extension);
+  virtual blink::WebString mimeTypeFromFile(
+      const blink::WebString& file_path);
 };
 
 class RendererWebKitPlatformSupportImpl::FileUtilities
-    : public webkit_glue::WebFileUtilitiesImpl {
+    : public WebFileUtilitiesImpl {
  public:
   explicit FileUtilities(ThreadSafeSender* sender)
       : thread_safe_sender_(sender) {}
@@ -167,7 +169,7 @@ class RendererWebKitPlatformSupportImpl::SandboxSupport {
 };
 #else
 class RendererWebKitPlatformSupportImpl::SandboxSupport
-    : public WebKit::WebSandboxSupport {
+    : public blink::WebSandboxSupport {
  public:
   virtual ~SandboxSupport() {}
 
@@ -180,18 +182,18 @@ class RendererWebKitPlatformSupportImpl::SandboxSupport
       uint32* font_id);
 #elif defined(OS_POSIX)
   virtual void getFontFamilyForCharacter(
-      WebKit::WebUChar32 character,
+      blink::WebUChar32 character,
       const char* preferred_locale,
-      WebKit::WebFontFamily* family);
+      blink::WebFontFamily* family);
   virtual void getRenderStyleForStrike(
-      const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out);
+      const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out);
 
  private:
   // WebKit likes to ask us for the correct font family to use for a set of
   // unicode code points. It needs this information frequently so we cache it
   // here.
   base::Lock unicode_font_families_mutex_;
-  std::map<int32_t, WebKit::WebFontFamily> unicode_font_families_;
+  std::map<int32_t, blink::WebFontFamily> unicode_font_families_;
 #endif
 };
 #endif  // defined(OS_ANDROID)
@@ -218,6 +220,9 @@ RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl()
     thread_safe_sender_ = ChildThread::current()->thread_safe_sender();
     quota_message_filter_ = ChildThread::current()->quota_message_filter();
     blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_));
+    web_idb_factory_.reset(new WebIDBFactoryImpl(thread_safe_sender_));
+    web_database_observer_impl_.reset(
+        new WebDatabaseObserverImpl(sync_message_filter_));
   }
 }
 
@@ -227,19 +232,19 @@ RendererWebKitPlatformSupportImpl::~RendererWebKitPlatformSupportImpl() {
 
 //------------------------------------------------------------------------------
 
-WebKit::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() {
-  WebKit::WebClipboard* clipboard =
+blink::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() {
+  blink::WebClipboard* clipboard =
       GetContentClient()->renderer()->OverrideWebClipboard();
   if (clipboard)
     return clipboard;
   return clipboard_.get();
 }
 
-WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() {
+blink::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() {
   return mime_registry_.get();
 }
 
-WebKit::WebFileUtilities*
+blink::WebFileUtilities*
 RendererWebKitPlatformSupportImpl::fileUtilities() {
   if (!file_utilities_) {
     file_utilities_.reset(new FileUtilities(thread_safe_sender_.get()));
@@ -248,7 +253,7 @@ RendererWebKitPlatformSupportImpl::fileUtilities() {
   return file_utilities_.get();
 }
 
-WebKit::WebSandboxSupport* RendererWebKitPlatformSupportImpl::sandboxSupport() {
+blink::WebSandboxSupport* RendererWebKitPlatformSupportImpl::sandboxSupport() {
 #if defined(OS_ANDROID)
   // WebKit doesn't use WebSandboxSupport on android.
   return NULL;
@@ -257,13 +262,13 @@ WebKit::WebSandboxSupport* RendererWebKitPlatformSupportImpl::sandboxSupport() {
 #endif
 }
 
-WebKit::WebCookieJar* RendererWebKitPlatformSupportImpl::cookieJar() {
+blink::WebCookieJar* RendererWebKitPlatformSupportImpl::cookieJar() {
   NOTREACHED() << "Use WebFrameClient::cookieJar() instead!";
   return NULL;
 }
 
-WebKit::WebThemeEngine* RendererWebKitPlatformSupportImpl::themeEngine() {
-  WebKit::WebThemeEngine* theme_engine =
+blink::WebThemeEngine* RendererWebKitPlatformSupportImpl::themeEngine() {
+  blink::WebThemeEngine* theme_engine =
       GetContentClient()->renderer()->OverrideThemeEngine();
   if (theme_engine)
     return theme_engine;
@@ -292,12 +297,12 @@ bool RendererWebKitPlatformSupportImpl::isLinkVisited(
   return GetContentClient()->renderer()->IsLinkVisited(link_hash);
 }
 
-WebKit::WebMessagePortChannel*
+blink::WebMessagePortChannel*
 RendererWebKitPlatformSupportImpl::createMessagePortChannel() {
   return new WebMessagePortChannelImpl(child_thread_loop_.get());
 }
 
-WebKit::WebPrescientNetworking*
+blink::WebPrescientNetworking*
 RendererWebKitPlatformSupportImpl::prescientNetworking() {
   return GetContentClient()->renderer()->GetPrescientNetworking();
 }
@@ -315,7 +320,7 @@ RendererWebKitPlatformSupportImpl::CheckPreparsedJsCachingEnabled() const {
 }
 
 void RendererWebKitPlatformSupportImpl::cacheMetadata(
-    const WebKit::WebURL& url,
+    const blink::WebURL& url,
     double response_time,
     const char* data,
     size_t size) {
@@ -331,7 +336,7 @@ void RendererWebKitPlatformSupportImpl::cacheMetadata(
 }
 
 WebString RendererWebKitPlatformSupportImpl::defaultLocale() {
-  return ASCIIToUTF16(RenderThread::Get()->GetLocale());
+  return base::ASCIIToUTF16(RenderThread::Get()->GetLocale());
 }
 
 void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) {
@@ -363,9 +368,6 @@ RendererWebKitPlatformSupportImpl::createLocalStorageNamespace() {
 //------------------------------------------------------------------------------
 
 WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() {
-  if (!web_idb_factory_)
-    web_idb_factory_.reset(
-        new RendererWebIDBFactoryImpl(thread_safe_sender_.get()));
   return web_idb_factory_.get();
 }
 
@@ -429,7 +431,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaMIMEType(
 
 bool
 RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaSourceMIMEType(
-    const WebKit::WebString& mime_type,
+    const blink::WebString& mime_type,
     const WebString& codecs) {
   const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type);
   std::vector<std::string> parsed_codec_ids;
@@ -452,7 +454,7 @@ RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension(
   RenderThread::Get()->Send(
       new MimeRegistryMsg_GetMimeTypeFromExtension(
           base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type));
-  return ASCIIToUTF16(mime_type);
+  return base::ASCIIToUTF16(mime_type);
 }
 
 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile(
@@ -466,7 +468,7 @@ WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile(
   RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile(
       base::FilePath::FromUTF16Unsafe(file_path),
       &mime_type));
-  return ASCIIToUTF16(mime_type);
+  return base::ASCIIToUTF16(mime_type);
 }
 
 //------------------------------------------------------------------------------
@@ -474,14 +476,14 @@ WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile(
 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo(
     const WebString& path,
     WebFileInfo& web_file_info) {
-  base::PlatformFileInfo file_info;
-  base::PlatformFileError status;
+  base::File::Info file_info;
+  base::File::Error status;
   if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
            base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) ||
-      status != base::PLATFORM_FILE_OK) {
+      status != base::File::FILE_OK) {
     return false;
   }
-  webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+  FileInfoToWebFileInfo(file_info, &web_file_info);
   web_file_info.platformPath = path;
   return true;
 }
@@ -547,11 +549,11 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::loadFont(
 
 void
 RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacter(
-    WebKit::WebUChar32 character,
+    blink::WebUChar32 character,
     const char* preferred_locale,
-    WebKit::WebFontFamily* family) {
+    blink::WebFontFamily* family) {
   base::AutoLock lock(unicode_font_families_mutex_);
-  const std::map<int32_t, WebKit::WebFontFamily>::const_iterator iter =
+  const std::map<int32_t, blink::WebFontFamily>::const_iterator iter =
       unicode_font_families_.find(character);
   if (iter != unicode_font_families_.end()) {
     family->name = iter->second.name;
@@ -566,7 +568,7 @@ RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacter(
 
 void
 RendererWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike(
-    const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out) {
+    const char* family, int sizeAndStyle, blink::WebFontRenderStyle* out) {
   GetRenderStyleForStrike(family, sizeAndStyle, out);
 }
 
@@ -612,11 +614,7 @@ bool RendererWebKitPlatformSupportImpl::canAccelerate2dCanvas() {
   if (!host)
     return false;
 
-  const gpu::GPUInfo& gpu_info = host->gpu_info();
-  if (gpu_info.can_lose_context || gpu_info.software_rendering)
-    return false;
-
-  return true;
+  return host->gpu_info().SupportsAccelerated2dCanvas();
 }
 
 bool RendererWebKitPlatformSupportImpl::isThreadedCompositingEnabled() {
@@ -638,6 +636,10 @@ unsigned RendererWebKitPlatformSupportImpl::audioHardwareOutputChannels() {
   return thread->GetAudioHardwareConfig()->GetOutputChannels();
 }
 
+WebDatabaseObserver* RendererWebKitPlatformSupportImpl::databaseObserver() {
+  return web_database_observer_impl_.get();
+}
+
 // TODO(crogers): remove deprecated API as soon as WebKit calls new API.
 WebAudioDevice*
 RendererWebKitPlatformSupportImpl::createAudioDevice(
@@ -668,9 +670,9 @@ RendererWebKitPlatformSupportImpl::createAudioDevice(
     unsigned channels,
     double sample_rate,
     WebAudioDevice::RenderCallback* callback,
-    const WebKit::WebString& input_device_id) {
+    const blink::WebString& input_device_id) {
   // Use a mock for testing.
-  WebKit::WebAudioDevice* mock_device =
+  blink::WebAudioDevice* mock_device =
       GetContentClient()->renderer()->OverrideCreateAudioDevice(sample_rate);
   if (mock_device)
     return mock_device;
@@ -712,7 +714,7 @@ RendererWebKitPlatformSupportImpl::createAudioDevice(
 
   int session_id = 0;
   if (input_device_id.isNull() ||
-      !base::StringToInt(UTF16ToUTF8(input_device_id), &session_id)) {
+      !base::StringToInt(base::UTF16ToUTF8(input_device_id), &session_id)) {
     if (input_channels > 0)
       DLOG(WARNING) << "createAudioDevice(): request for audio input ignored";
 
@@ -722,14 +724,15 @@ RendererWebKitPlatformSupportImpl::createAudioDevice(
   media::AudioParameters params(
       media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
       layout, input_channels,
-      static_cast<int>(sample_rate), 16, buffer_size);
+      static_cast<int>(sample_rate), 16, buffer_size,
+      media::AudioParameters::NO_EFFECTS);
 
   return new RendererWebAudioDeviceImpl(params, callback, session_id);
 }
 
 #if defined(OS_ANDROID)
 bool RendererWebKitPlatformSupportImpl::loadAudioResource(
-    WebKit::WebAudioBus* destination_bus, const char* audio_file_data,
+    blink::WebAudioBus* destination_bus, const char* audio_file_data,
     size_t data_size, double sample_rate) {
   return DecodeAudioFileData(destination_bus,
                              audio_file_data,
@@ -739,7 +742,7 @@ bool RendererWebKitPlatformSupportImpl::loadAudioResource(
 }
 #else
 bool RendererWebKitPlatformSupportImpl::loadAudioResource(
-    WebKit::WebAudioBus* destination_bus, const char* audio_file_data,
+    blink::WebAudioBus* destination_bus, const char* audio_file_data,
     size_t data_size, double sample_rate) {
   return DecodeAudioFileData(
       destination_bus, audio_file_data, data_size, sample_rate);
@@ -748,18 +751,18 @@ bool RendererWebKitPlatformSupportImpl::loadAudioResource(
 
 //------------------------------------------------------------------------------
 
-WebKit::WebContentDecryptionModule*
+blink::WebContentDecryptionModule*
 RendererWebKitPlatformSupportImpl::createContentDecryptionModule(
-    const WebKit::WebString& key_system) {
+    const blink::WebString& key_system) {
   return WebContentDecryptionModuleImpl::Create(key_system);
 }
 
 //------------------------------------------------------------------------------
 
-WebKit::WebMIDIAccessor*
+blink::WebMIDIAccessor*
 RendererWebKitPlatformSupportImpl::createMIDIAccessor(
-    WebKit::WebMIDIAccessorClient* client) {
-  WebKit::WebMIDIAccessor* accessor =
+    blink::WebMIDIAccessorClient* client) {
+  blink::WebMIDIAccessor* accessor =
       GetContentClient()->renderer()->OverrideCreateMIDIAccessor(client);
   if (accessor)
     return accessor;
@@ -769,7 +772,7 @@ RendererWebKitPlatformSupportImpl::createMIDIAccessor(
 
 void RendererWebKitPlatformSupportImpl::getPluginList(
     bool refresh,
-    WebKit::WebPluginListBuilder* builder) {
+    blink::WebPluginListBuilder* builder) {
 #if defined(ENABLE_PLUGINS)
   std::vector<WebPluginInfo> plugins;
   if (!plugin_refresh_allowed_)
@@ -800,11 +803,18 @@ void RendererWebKitPlatformSupportImpl::getPluginList(
 
 //------------------------------------------------------------------------------
 
-WebKit::WebString
+blink::WebPublicSuffixList*
+RendererWebKitPlatformSupportImpl::publicSuffixList() {
+  return &public_suffix_list_;
+}
+
+//------------------------------------------------------------------------------
+
+blink::WebString
 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
     unsigned key_size_index,
-    const WebKit::WebString& challenge,
-    const WebKit::WebURL& url) {
+    const blink::WebString& challenge,
+    const blink::WebURL& url) {
   std::string signed_public_key;
   RenderThread::Get()->Send(new ViewHostMsg_Keygen(
       static_cast<uint32>(key_size_index),
@@ -818,10 +828,17 @@ RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
 
 void RendererWebKitPlatformSupportImpl::screenColorProfile(
     WebVector<char>* to_profile) {
+#if defined(OS_WIN)
+  // On Windows screen color profile is only available in the browser.
   std::vector<char> profile;
   RenderThread::Get()->Send(
       new ViewHostMsg_GetMonitorColorProfile(&profile));
   *to_profile = profile;
+#else
+  // On other platforms color profile can be obtained directly.
+  gfx::ColorProfile profile;
+  *to_profile = profile.profile();
+#endif
 }
 
 //------------------------------------------------------------------------------
@@ -841,8 +858,8 @@ void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) {
   }
 }
 
-WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent(
-    const WebKit::WebURL& url) {
+blink::WebString RendererWebKitPlatformSupportImpl::userAgent(
+    const blink::WebURL& url) {
   return WebKitPlatformSupportImpl::userAgent(url);
 }
 
@@ -899,9 +916,9 @@ void RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(
 
 //------------------------------------------------------------------------------
 
-WebKit::WebSpeechSynthesizer*
+blink::WebSpeechSynthesizer*
 RendererWebKitPlatformSupportImpl::createSpeechSynthesizer(
-    WebKit::WebSpeechSynthesizerClient* client) {
+    blink::WebSpeechSynthesizerClient* client) {
   return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client);
 }
 
@@ -916,51 +933,65 @@ bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes(
 
 //------------------------------------------------------------------------------
 
-WebKit::WebGraphicsContext3D*
+blink::WebGraphicsContext3D*
 RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
-    const WebKit::WebGraphicsContext3D::Attributes& attributes) {
+    const blink::WebGraphicsContext3D::Attributes& attributes) {
   if (!RenderThreadImpl::current())
     return NULL;
 
   scoped_refptr<GpuChannelHost> gpu_channel_host(
       RenderThreadImpl::current()->EstablishGpuChannelSync(
           CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
+
+  WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
+
+  CommandLine* command_line = CommandLine::ForCurrentProcess();
+  if (command_line->HasSwitch(switches::kWebGLCommandBufferSizeKb)) {
+    std::string size_string = command_line->GetSwitchValueASCII(
+        switches::kWebGLCommandBufferSizeKb);
+    size_t buffer_size_kb;
+    if (base::StringToSizeT(size_string, &buffer_size_kb)) {
+      limits.command_buffer_size = buffer_size_kb * 1024;
+    }
+  }
+
   return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
       gpu_channel_host.get(),
       attributes,
-      GURL(attributes.topDocumentURL));
+      GURL(attributes.topDocumentURL),
+      limits);
 }
 
 //------------------------------------------------------------------------------
 
-WebKit::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
+blink::WebGraphicsContext3DProvider* RendererWebKitPlatformSupportImpl::
     createSharedOffscreenGraphicsContext3DProvider() {
-  scoped_refptr<cc::ContextProvider> provider =
+  scoped_refptr<webkit::gpu::ContextProviderWebContext> provider =
       RenderThreadImpl::current()->SharedMainThreadContextProvider();
   if (!provider)
     return NULL;
-  return new webkit::gpu::WebGraphicsContext3DProviderImpl(provider);
+  return new WebGraphicsContext3DProviderImpl(provider);
 }
 
 //------------------------------------------------------------------------------
 
-WebKit::WebCompositorSupport*
+blink::WebCompositorSupport*
 RendererWebKitPlatformSupportImpl::compositorSupport() {
   return &compositor_support_;
 }
 
 //------------------------------------------------------------------------------
 
-WebKit::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
-    const WebKit::WebString& host,
-    const WebKit::WebString& languages) {
+blink::WebString RendererWebKitPlatformSupportImpl::convertIDNToUnicode(
+    const blink::WebString& host,
+    const blink::WebString& languages) {
   return net::IDNToUnicode(host.utf8(), languages.utf8());
 }
 
 //------------------------------------------------------------------------------
 
 void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
-    WebKit::WebDeviceMotionListener* listener) {
+    blink::WebDeviceMotionListener* listener) {
   if (g_test_device_motion_data == 0) {
     if (!device_motion_event_pump_) {
       device_motion_event_pump_.reset(new DeviceMotionEventPump);
@@ -971,7 +1002,7 @@ void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
     // Testing mode: just echo the test data to the listener.
     base::MessageLoopProxy::current()->PostTask(
         FROM_HERE,
-        base::Bind(&WebKit::WebDeviceMotionListener::didChangeDeviceMotion,
+        base::Bind(&blink::WebDeviceMotionListener::didChangeDeviceMotion,
                    base::Unretained(listener),
                    g_test_device_motion_data.Get()));
   }
@@ -979,14 +1010,14 @@ void RendererWebKitPlatformSupportImpl::setDeviceMotionListener(
 
 // static
 void RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(
-    const WebKit::WebDeviceMotionData& data) {
+    const blink::WebDeviceMotionData& data) {
   g_test_device_motion_data.Get() = data;
 }
 
 //------------------------------------------------------------------------------
 
 void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener(
-    WebKit::WebDeviceOrientationListener* listener) {
+    blink::WebDeviceOrientationListener* listener) {
   if (g_test_device_orientation_data == 0) {
     if (!device_orientation_event_pump_) {
       device_orientation_event_pump_.reset(new DeviceOrientationEventPump);
@@ -998,7 +1029,7 @@ void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener(
     base::MessageLoopProxy::current()->PostTask(
         FROM_HERE,
         base::Bind(
-            &WebKit::WebDeviceOrientationListener::didChangeDeviceOrientation,
+            &blink::WebDeviceOrientationListener::didChangeDeviceOrientation,
             base::Unretained(listener),
             g_test_device_orientation_data.Get()));
   }
@@ -1006,13 +1037,13 @@ void RendererWebKitPlatformSupportImpl::setDeviceOrientationListener(
 
 // static
 void RendererWebKitPlatformSupportImpl::SetMockDeviceOrientationDataForTesting(
-    const WebKit::WebDeviceOrientationData& data) {
+    const blink::WebDeviceOrientationData& data) {
   g_test_device_orientation_data.Get() = data;
 }
 
 //------------------------------------------------------------------------------
 
-WebKit::WebCrypto* RendererWebKitPlatformSupportImpl::crypto() {
+blink::WebCrypto* RendererWebKitPlatformSupportImpl::crypto() {
   if (!web_crypto_)
     web_crypto_.reset(new WebCryptoImpl());
   return web_crypto_.get();
@@ -1023,7 +1054,7 @@ WebKit::WebCrypto* RendererWebKitPlatformSupportImpl::crypto() {
 
 void RendererWebKitPlatformSupportImpl::vibrate(unsigned int milliseconds) {
   RenderThread::Get()->Send(
-      new ViewHostMsg_Vibrate(base::checked_numeric_cast<int64>(milliseconds)));
+      new ViewHostMsg_Vibrate(base::checked_cast<int64>(milliseconds)));
 }
 
 void RendererWebKitPlatformSupportImpl::cancelVibration() {
@@ -1033,9 +1064,9 @@ void RendererWebKitPlatformSupportImpl::cancelVibration() {
 //------------------------------------------------------------------------------
 
 void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota(
-    const WebKit::WebURL& storage_partition,
-    WebKit::WebStorageQuotaType type,
-    WebKit::WebStorageQuotaCallbacks* callbacks) {
+    const blink::WebURL& storage_partition,
+    blink::WebStorageQuotaType type,
+    blink::WebStorageQuotaCallbacks callbacks) {
   if (!thread_safe_sender_.get() || !quota_message_filter_.get())
     return;
   QuotaDispatcher::ThreadSpecificInstance(