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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 bool direct) { | 1495 bool direct) { |
1496 if (!webview()) | 1496 if (!webview()) |
1497 return NULL; | 1497 return NULL; |
1498 // The WebGraphicsContext3DInProcessImpl code path is used for | 1498 // The WebGraphicsContext3DInProcessImpl code path is used for |
1499 // layout tests (though not through this code) as well as for | 1499 // layout tests (though not through this code) as well as for |
1500 // debugging and bringing up new ports. | 1500 // debugging and bringing up new ports. |
1501 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { | 1501 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { |
1502 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( | 1502 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( |
1503 attributes, webview(), direct); | 1503 attributes, webview(), direct); |
1504 } else { | 1504 } else { |
1505 scoped_ptr<WebGraphicsContext3D> context( | 1505 int surface = direct ? surface_id() : 0; |
1506 new WebGraphicsContext3DCommandBufferImpl()); | 1506 |
1507 if (!context->initialize(attributes, webview(), direct)) | 1507 GURL url; |
| 1508 if (webview()->mainFrame()) |
| 1509 url = GURL(webview()->mainFrame()->document().url()); |
| 1510 |
| 1511 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; |
| 1512 if (direct) |
| 1513 swap_client = AsWeakPtr(); |
| 1514 |
| 1515 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 1516 new WebGraphicsContext3DCommandBufferImpl( |
| 1517 surface, url, swap_client)); |
| 1518 |
| 1519 if (!context->Initialize(attributes)) |
1508 return NULL; | 1520 return NULL; |
1509 return context.release(); | 1521 return context.release(); |
1510 } | 1522 } |
1511 } | 1523 } |
1512 | 1524 |
1513 void RenderViewImpl::didAddMessageToConsole( | 1525 void RenderViewImpl::didAddMessageToConsole( |
1514 const WebConsoleMessage& message, const WebString& source_name, | 1526 const WebConsoleMessage& message, const WebString& source_name, |
1515 unsigned source_line) { | 1527 unsigned source_line) { |
1516 logging::LogSeverity log_severity = logging::LOG_VERBOSE; | 1528 logging::LogSeverity log_severity = logging::LOG_VERBOSE; |
1517 switch (message.level) { | 1529 switch (message.level) { |
(...skipping 3457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4987 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
4976 return !!RenderThreadImpl::current()->compositor_thread(); | 4988 return !!RenderThreadImpl::current()->compositor_thread(); |
4977 } | 4989 } |
4978 | 4990 |
4979 void RenderViewImpl::OnJavaBridgeInit() { | 4991 void RenderViewImpl::OnJavaBridgeInit() { |
4980 DCHECK(!java_bridge_dispatcher_.get()); | 4992 DCHECK(!java_bridge_dispatcher_.get()); |
4981 #if defined(ENABLE_JAVA_BRIDGE) | 4993 #if defined(ENABLE_JAVA_BRIDGE) |
4982 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4994 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
4983 #endif | 4995 #endif |
4984 } | 4996 } |
OLD | NEW |