| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/test_runner/test_plugin.h" | 5 #include "components/test_runner/test_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "cc/blink/web_layer_impl.h" | 15 #include "cc/blink/web_layer_impl.h" |
| 16 #include "cc/layers/texture_layer.h" | 16 #include "cc/layers/texture_layer.h" |
| 17 #include "cc/resources/shared_bitmap_manager.h" | 17 #include "cc/resources/shared_bitmap_manager.h" |
| 18 #include "components/test_runner/web_test_delegate.h" | 18 #include "components/test_runner/web_test_delegate.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "third_party/WebKit/public/platform/Platform.h" | 20 #include "third_party/WebKit/public/platform/Platform.h" |
| 21 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" | 21 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" |
| 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" | 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" |
| 24 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 24 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 25 #include "third_party/WebKit/public/platform/WebThread.h" | 25 #include "third_party/WebKit/public/platform/WebThread.h" |
| 26 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 26 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 27 #include "third_party/WebKit/public/platform/WebURL.h" |
| 27 #include "third_party/WebKit/public/web/WebFrame.h" | 28 #include "third_party/WebKit/public/web/WebFrame.h" |
| 28 #include "third_party/WebKit/public/web/WebInputEvent.h" | 29 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 29 #include "third_party/WebKit/public/web/WebKit.h" | 30 #include "third_party/WebKit/public/web/WebKit.h" |
| 30 #include "third_party/WebKit/public/web/WebPluginParams.h" | 31 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 31 #include "third_party/WebKit/public/web/WebTouchPoint.h" | 32 #include "third_party/WebKit/public/web/WebTouchPoint.h" |
| 32 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 33 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 33 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
| 34 #include "third_party/skia/include/core/SkCanvas.h" | 35 #include "third_party/skia/include/core/SkCanvas.h" |
| 35 #include "third_party/skia/include/core/SkColor.h" | 36 #include "third_party/skia/include/core/SkColor.h" |
| 36 #include "third_party/skia/include/core/SkPaint.h" | 37 #include "third_party/skia/include/core/SkPaint.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 if (can_create_without_renderer_) | 168 if (can_create_without_renderer_) |
| 168 delegate_->PrintMessage( | 169 delegate_->PrintMessage( |
| 169 std::string("TestPlugin: canCreateWithoutRenderer\n")); | 170 std::string("TestPlugin: canCreateWithoutRenderer\n")); |
| 170 } | 171 } |
| 171 | 172 |
| 172 TestPlugin::~TestPlugin() { | 173 TestPlugin::~TestPlugin() { |
| 173 } | 174 } |
| 174 | 175 |
| 175 bool TestPlugin::initialize(blink::WebPluginContainer* container) { | 176 bool TestPlugin::initialize(blink::WebPluginContainer* container) { |
| 176 blink::WebGraphicsContext3D::Attributes attrs; | 177 blink::Platform::ContextAttributes attrs; |
| 178 DCHECK(!container->element().isNull()); |
| 179 DCHECK(!container->element().document().isNull()); |
| 180 blink::WebURL url = container->element().document().url(); |
| 177 blink::Platform::GraphicsInfo gl_info; | 181 blink::Platform::GraphicsInfo gl_info; |
| 178 context_provider_ = make_scoped_ptr( | 182 context_provider_ = make_scoped_ptr( |
| 179 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( | 183 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( |
| 180 attrs, nullptr, &gl_info)); | 184 attrs, url, nullptr, &gl_info)); |
| 181 context_ = context_provider_ ? context_provider_->context3d() : nullptr; | 185 context_ = context_provider_ ? context_provider_->context3d() : nullptr; |
| 182 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; | 186 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; |
| 183 | 187 |
| 184 if (!InitScene()) | 188 if (!InitScene()) |
| 185 return false; | 189 return false; |
| 186 | 190 |
| 187 layer_ = cc::TextureLayer::CreateForMailbox(this); | 191 layer_ = cc::TextureLayer::CreateForMailbox(this); |
| 188 web_layer_ = make_scoped_ptr(new cc_blink::WebLayerImpl(layer_)); | 192 web_layer_ = make_scoped_ptr(new cc_blink::WebLayerImpl(layer_)); |
| 189 container_ = container; | 193 container_ = container; |
| 190 container_->setWebLayer(web_layer_.get()); | 194 container_->setWebLayer(web_layer_.get()); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return kPluginPersistsMimeType; | 728 return kPluginPersistsMimeType; |
| 725 } | 729 } |
| 726 | 730 |
| 727 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 731 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
| 728 return mime_type == TestPlugin::MimeType() || | 732 return mime_type == TestPlugin::MimeType() || |
| 729 mime_type == PluginPersistsMimeType() || | 733 mime_type == PluginPersistsMimeType() || |
| 730 mime_type == CanCreateWithoutRendererMimeType(); | 734 mime_type == CanCreateWithoutRendererMimeType(); |
| 731 } | 735 } |
| 732 | 736 |
| 733 } // namespace test_runner | 737 } // namespace test_runner |
| OLD | NEW |