OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 } | 1883 } |
1884 | 1884 |
1885 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace( | 1885 WebStorageNamespace* RenderViewImpl::createSessionStorageNamespace( |
1886 unsigned quota) { | 1886 unsigned quota) { |
1887 CHECK(session_storage_namespace_id_ != | 1887 CHECK(session_storage_namespace_id_ != |
1888 dom_storage::kInvalidSessionStorageNamespaceId); | 1888 dom_storage::kInvalidSessionStorageNamespaceId); |
1889 return new WebStorageNamespaceImpl(session_storage_namespace_id_); | 1889 return new WebStorageNamespaceImpl(session_storage_namespace_id_); |
1890 } | 1890 } |
1891 | 1891 |
1892 WebKit::WebCompositorOutputSurface* RenderViewImpl::createOutputSurface() { | 1892 WebKit::WebCompositorOutputSurface* RenderViewImpl::createOutputSurface() { |
| 1893 CommandBufferProxyImpl* proxy = NULL; |
1893 // Explicitly disable antialiasing for the compositor. As of the time of | 1894 // Explicitly disable antialiasing for the compositor. As of the time of |
1894 // this writing, the only platform that supported antialiasing for the | 1895 // this writing, the only platform that supported antialiasing for the |
1895 // compositor was Mac OS X, because the on-screen OpenGL context creation | 1896 // compositor was Mac OS X, because the on-screen OpenGL context creation |
1896 // code paths on Windows and Linux didn't yet have multisampling support. | 1897 // code paths on Windows and Linux didn't yet have multisampling support. |
1897 // Mac OS X essentially always behaves as though it's rendering offscreen. | 1898 // Mac OS X essentially always behaves as though it's rendering offscreen. |
1898 // Multisampling has a heavy cost especially on devices with relatively low | 1899 // Multisampling has a heavy cost especially on devices with relatively low |
1899 // fill rate like most notebooks, and the Mac implementation would need to | 1900 // fill rate like most notebooks, and the Mac implementation would need to |
1900 // be optimized to resolve directly into the IOSurface shared between the | 1901 // be optimized to resolve directly into the IOSurface shared between the |
1901 // GPU and browser processes. For these reasons and to avoid platform | 1902 // GPU and browser processes. For these reasons and to avoid platform |
1902 // disparities we explicitly disable antialiasing. | 1903 // disparities we explicitly disable antialiasing. |
1903 WebKit::WebGraphicsContext3D::Attributes attributes; | 1904 WebKit::WebGraphicsContext3D::Attributes attributes; |
1904 attributes.antialias = false; | 1905 attributes.antialias = false; |
1905 attributes.shareResources = true; | 1906 attributes.shareResources = true; |
1906 attributes.noAutomaticFlushes = true; | 1907 attributes.noAutomaticFlushes = true; |
1907 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); | 1908 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes, &proxy); |
1908 if (!context) | 1909 if (!context) |
1909 return NULL; | 1910 return NULL; |
1910 | 1911 |
1911 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1912 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1912 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 1913 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
1913 // In the absence of a software-based delegating renderer, use this | 1914 // In the absence of a software-based delegating renderer, use this |
1914 // stopgap adapter class to present the software renderer output using a | 1915 // stopgap adapter class to present the software renderer output using a |
1915 // 3d context. | 1916 // 3d context. |
1916 return new CompositorOutputSurface(routing_id(), NULL, | 1917 return new CompositorOutputSurface(routing_id(), NULL, NULL, |
1917 new CompositorSoftwareOutputDeviceGLAdapter(context)); | 1918 new CompositorSoftwareOutputDeviceGLAdapter(context)); |
1918 } else | 1919 } else |
1919 return new CompositorOutputSurface(routing_id(), context, NULL); | 1920 return new CompositorOutputSurface(routing_id(), context, proxy, NULL); |
1920 } | 1921 } |
1921 | 1922 |
1922 void RenderViewImpl::didAddMessageToConsole( | 1923 void RenderViewImpl::didAddMessageToConsole( |
1923 const WebConsoleMessage& message, const WebString& source_name, | 1924 const WebConsoleMessage& message, const WebString& source_name, |
1924 unsigned source_line) { | 1925 unsigned source_line) { |
1925 logging::LogSeverity log_severity = logging::LOG_VERBOSE; | 1926 logging::LogSeverity log_severity = logging::LOG_VERBOSE; |
1926 switch (message.level) { | 1927 switch (message.level) { |
1927 case WebConsoleMessage::LevelTip: | 1928 case WebConsoleMessage::LevelTip: |
1928 log_severity = logging::LOG_VERBOSE; | 1929 log_severity = logging::LOG_VERBOSE; |
1929 break; | 1930 break; |
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3870 | 3871 |
3871 if (size == preferred_size_) | 3872 if (size == preferred_size_) |
3872 return; | 3873 return; |
3873 | 3874 |
3874 preferred_size_ = size; | 3875 preferred_size_ = size; |
3875 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 3876 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
3876 preferred_size_)); | 3877 preferred_size_)); |
3877 } | 3878 } |
3878 | 3879 |
3879 WebGraphicsContext3D* RenderViewImpl::CreateGraphicsContext3D( | 3880 WebGraphicsContext3D* RenderViewImpl::CreateGraphicsContext3D( |
3880 const WebGraphicsContext3D::Attributes& attributes) { | 3881 const WebGraphicsContext3D::Attributes& attributes, |
| 3882 CommandBufferProxyImpl** proxy) { |
| 3883 *proxy = NULL; |
3881 if (!webview()) | 3884 if (!webview()) |
3882 return NULL; | 3885 return NULL; |
3883 | 3886 |
3884 // The WebGraphicsContext3DInProcessImpl code path is used for | 3887 // The WebGraphicsContext3DInProcessImpl code path is used for |
3885 // layout tests (though not through this code) as well as for | 3888 // layout tests (though not through this code) as well as for |
3886 // debugging and bringing up new ports. | 3889 // debugging and bringing up new ports. |
3887 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { | 3890 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
3888 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( | 3891 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
3889 attributes, true); | 3892 attributes, true); |
3890 } else { | 3893 } else { |
3891 GURL url; | 3894 GURL url; |
3892 if (webview()->mainFrame()) | 3895 if (webview()->mainFrame()) |
3893 url = GURL(webview()->mainFrame()->document().url()); | 3896 url = GURL(webview()->mainFrame()->document().url()); |
3894 else | 3897 else |
3895 url = GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3898 url = GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
3896 | 3899 |
3897 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 3900 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
3898 new WebGraphicsContext3DCommandBufferImpl( | 3901 new WebGraphicsContext3DCommandBufferImpl( |
3899 surface_id(), | 3902 surface_id(), |
3900 url, | 3903 url, |
3901 RenderThreadImpl::current(), | 3904 RenderThreadImpl::current(), |
3902 AsWeakPtr())); | 3905 AsWeakPtr())); |
3903 | 3906 |
3904 if (!context->Initialize( | 3907 if (!context->Initialize( |
3905 attributes, | 3908 attributes, |
3906 false /* bind generates resources */, | 3909 false /* bind generates resources */, |
3907 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)) | 3910 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)) |
3908 return NULL; | 3911 return NULL; |
| 3912 *proxy = context->GetCommandBufferProxy(); |
3909 return context.release(); | 3913 return context.release(); |
3910 } | 3914 } |
3911 } | 3915 } |
3912 | 3916 |
3913 // The browser process needs to know the shape of the tree, as well as the names | 3917 // The browser process needs to know the shape of the tree, as well as the names |
3914 // and ids of all frames. This allows it to properly route JavaScript messages | 3918 // and ids of all frames. This allows it to properly route JavaScript messages |
3915 // across processes and frames. The serialization format is described in the | 3919 // across processes and frames. The serialization format is described in the |
3916 // comments of the ViewMsg_FrameTreeUpdated message. | 3920 // comments of the ViewMsg_FrameTreeUpdated message. |
3917 // This function sends those updates to the browser and updates the RVH | 3921 // This function sends those updates to the browser and updates the RVH |
3918 // corresponding to this object. It must be called on any events that modify | 3922 // corresponding to this object. It must be called on any events that modify |
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6505 } | 6509 } |
6506 #endif | 6510 #endif |
6507 | 6511 |
6508 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6512 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6509 TransportDIB::Handle dib_handle) { | 6513 TransportDIB::Handle dib_handle) { |
6510 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6514 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6511 RenderProcess::current()->ReleaseTransportDIB(dib); | 6515 RenderProcess::current()->ReleaseTransportDIB(dib); |
6512 } | 6516 } |
6513 | 6517 |
6514 } // namespace content | 6518 } // namespace content |
OLD | NEW |