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 "webkit/support/webkit_support.h" | 5 #include "webkit/support/webkit_support.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 new WebGraphicsContext3DInProcessCommandBufferImpl()); | 513 new WebGraphicsContext3DInProcessCommandBufferImpl()); |
514 if (!context->Initialize(attributes, NULL)) | 514 if (!context->Initialize(attributes, NULL)) |
515 return NULL; | 515 return NULL; |
516 return context.release(); | 516 return context.release(); |
517 } | 517 } |
518 } | 518 } |
519 NOTREACHED(); | 519 NOTREACHED(); |
520 return NULL; | 520 return NULL; |
521 } | 521 } |
522 | 522 |
| 523 template <typename Client> |
523 static WebKit::WebLayerTreeView* CreateLayerTreeView( | 524 static WebKit::WebLayerTreeView* CreateLayerTreeView( |
524 WebKit::WebLayerTreeViewImplForTesting::RenderingType type, | 525 WebKit::WebLayerTreeViewImplForTesting::RenderingType type, |
525 WebKit::WebLayerTreeViewClient* client) { | 526 Client* client) { |
526 scoped_ptr<WebKit::WebLayerTreeViewImplForTesting> view( | 527 scoped_ptr<WebKit::WebLayerTreeViewImplForTesting> view( |
527 new WebKit::WebLayerTreeViewImplForTesting(type, client)); | 528 new WebKit::WebLayerTreeViewImplForTesting(type, client)); |
528 | 529 |
529 scoped_ptr<cc::Thread> compositor_thread; | 530 scoped_ptr<cc::Thread> compositor_thread; |
530 | 531 |
531 webkit::WebCompositorSupportImpl* compositor_support_impl = | 532 webkit::WebCompositorSupportImpl* compositor_support_impl = |
532 test_environment->webkit_platform_support()->compositor_support_impl(); | 533 test_environment->webkit_platform_support()->compositor_support_impl(); |
533 if (compositor_support_impl->compositor_thread_message_loop_proxy()) | 534 if (compositor_support_impl->compositor_thread_message_loop_proxy()) |
534 compositor_thread = cc::ThreadImpl::createForDifferentThread( | 535 compositor_thread = cc::ThreadImpl::createForDifferentThread( |
535 compositor_support_impl->compositor_thread_message_loop_proxy()); | 536 compositor_support_impl->compositor_thread_message_loop_proxy()); |
536 | 537 |
537 if (!view->initialize(compositor_thread.Pass())) | 538 if (!view->initialize(compositor_thread.Pass())) |
538 return NULL; | 539 return NULL; |
539 return view.release(); | 540 return view.release(); |
540 } | 541 } |
541 | 542 |
542 WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( | 543 WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( |
543 WebKit::WebLayerTreeViewClient* client) { | 544 WebKit::WebLayerTreeViewClient* client) { |
544 return CreateLayerTreeView( | 545 return CreateLayerTreeView( |
545 WebKit::WebLayerTreeViewImplForTesting::SOFTWARE_CONTEXT, client); | 546 WebKit::WebLayerTreeViewImplForTesting::SOFTWARE_CONTEXT, client); |
546 } | 547 } |
547 | 548 |
548 WebKit::WebLayerTreeView* CreateLayerTreeView3d( | 549 WebKit::WebLayerTreeView* CreateLayerTreeView3d( |
549 WebKit::WebLayerTreeViewClient* client) { | 550 WebKit::WebLayerTreeViewClient* client) { |
550 return CreateLayerTreeView( | 551 return CreateLayerTreeView( |
551 WebKit::WebLayerTreeViewImplForTesting::MESA_CONTEXT, client); | 552 WebKit::WebLayerTreeViewImplForTesting::MESA_CONTEXT, client); |
552 } | 553 } |
553 | 554 |
| 555 WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( |
| 556 DRTLayerTreeViewClient* client) { |
| 557 return CreateLayerTreeView( |
| 558 WebKit::WebLayerTreeViewImplForTesting::SOFTWARE_CONTEXT, client); |
| 559 } |
| 560 |
| 561 WebKit::WebLayerTreeView* CreateLayerTreeView3d( |
| 562 DRTLayerTreeViewClient* client) { |
| 563 return CreateLayerTreeView( |
| 564 WebKit::WebLayerTreeViewImplForTesting::MESA_CONTEXT, client); |
| 565 } |
| 566 |
554 void RegisterMockedURL(const WebKit::WebURL& url, | 567 void RegisterMockedURL(const WebKit::WebURL& url, |
555 const WebKit::WebURLResponse& response, | 568 const WebKit::WebURLResponse& response, |
556 const WebKit::WebString& file_path) { | 569 const WebKit::WebString& file_path) { |
557 test_environment->webkit_platform_support()->url_loader_factory()-> | 570 test_environment->webkit_platform_support()->url_loader_factory()-> |
558 RegisterURL(url, response, file_path); | 571 RegisterURL(url, response, file_path); |
559 } | 572 } |
560 | 573 |
561 void RegisterMockedErrorURL(const WebKit::WebURL& url, | 574 void RegisterMockedErrorURL(const WebKit::WebURL& url, |
562 const WebKit::WebURLResponse& response, | 575 const WebKit::WebURLResponse& response, |
563 const WebKit::WebURLError& error) { | 576 const WebKit::WebURLError& error) { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 // Logging | 929 // Logging |
917 void EnableWebCoreLogChannels(const std::string& channels) { | 930 void EnableWebCoreLogChannels(const std::string& channels) { |
918 webkit_glue::EnableWebCoreLogChannels(channels); | 931 webkit_glue::EnableWebCoreLogChannels(channels); |
919 } | 932 } |
920 | 933 |
921 void SetGamepadData(const WebKit::WebGamepads& pads) { | 934 void SetGamepadData(const WebKit::WebGamepads& pads) { |
922 test_environment->webkit_platform_support()->setGamepadData(pads); | 935 test_environment->webkit_platform_support()->setGamepadData(pads); |
923 } | 936 } |
924 | 937 |
925 } // namespace webkit_support | 938 } // namespace webkit_support |
OLD | NEW |