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 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "cc/blink/web_layer_impl.h" | 17 #include "cc/blink/web_layer_impl.h" |
18 #include "cc/layers/texture_layer.h" | 18 #include "cc/layers/texture_layer.h" |
19 #include "cc/resources/shared_bitmap_manager.h" | 19 #include "cc/resources/shared_bitmap_manager.h" |
20 #include "components/test_runner/web_test_delegate.h" | 20 #include "components/test_runner/web_test_delegate.h" |
21 #include "gpu/command_buffer/client/gles2_interface.h" | 21 #include "gpu/command_buffer/client/gles2_interface.h" |
22 #include "third_party/WebKit/public/platform/Platform.h" | 22 #include "third_party/WebKit/public/platform/Platform.h" |
23 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" | 23 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" |
24 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | |
25 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" | 24 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" |
26 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 25 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
27 #include "third_party/WebKit/public/platform/WebThread.h" | 26 #include "third_party/WebKit/public/platform/WebThread.h" |
28 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 27 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
29 #include "third_party/WebKit/public/platform/WebURL.h" | 28 #include "third_party/WebKit/public/platform/WebURL.h" |
30 #include "third_party/WebKit/public/web/WebFrame.h" | 29 #include "third_party/WebKit/public/web/WebFrame.h" |
31 #include "third_party/WebKit/public/web/WebInputEvent.h" | 30 #include "third_party/WebKit/public/web/WebInputEvent.h" |
32 #include "third_party/WebKit/public/web/WebKit.h" | 31 #include "third_party/WebKit/public/web/WebKit.h" |
33 #include "third_party/WebKit/public/web/WebPluginParams.h" | 32 #include "third_party/WebKit/public/web/WebPluginParams.h" |
34 #include "third_party/WebKit/public/web/WebTouchPoint.h" | 33 #include "third_party/WebKit/public/web/WebTouchPoint.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 117 }; |
119 | 118 |
120 } // namespace | 119 } // namespace |
121 | 120 |
122 TestPlugin::TestPlugin(blink::WebFrame* frame, | 121 TestPlugin::TestPlugin(blink::WebFrame* frame, |
123 const blink::WebPluginParams& params, | 122 const blink::WebPluginParams& params, |
124 WebTestDelegate* delegate) | 123 WebTestDelegate* delegate) |
125 : frame_(frame), | 124 : frame_(frame), |
126 delegate_(delegate), | 125 delegate_(delegate), |
127 container_(nullptr), | 126 container_(nullptr), |
128 context_(nullptr), | |
129 gl_(nullptr), | 127 gl_(nullptr), |
130 color_texture_(0), | 128 color_texture_(0), |
131 mailbox_changed_(false), | 129 mailbox_changed_(false), |
132 framebuffer_(0), | 130 framebuffer_(0), |
133 touch_event_request_( | 131 touch_event_request_( |
134 blink::WebPluginContainer::TouchEventRequestTypeNone), | 132 blink::WebPluginContainer::TouchEventRequestTypeNone), |
135 re_request_touch_events_(false), | 133 re_request_touch_events_(false), |
136 print_event_details_(false), | 134 print_event_details_(false), |
137 print_user_gesture_status_(false), | 135 print_user_gesture_status_(false), |
138 can_process_drag_(false), | 136 can_process_drag_(false), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 container_ = container; | 180 container_ = container; |
183 | 181 |
184 blink::Platform::ContextAttributes attrs; | 182 blink::Platform::ContextAttributes attrs; |
185 DCHECK(!container->element().isNull()); | 183 DCHECK(!container->element().isNull()); |
186 DCHECK(!container->element().document().isNull()); | 184 DCHECK(!container->element().document().isNull()); |
187 blink::WebURL url = container->element().document().url(); | 185 blink::WebURL url = container->element().document().url(); |
188 blink::Platform::GraphicsInfo gl_info; | 186 blink::Platform::GraphicsInfo gl_info; |
189 context_provider_ = base::WrapUnique( | 187 context_provider_ = base::WrapUnique( |
190 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( | 188 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( |
191 attrs, url, nullptr, &gl_info)); | 189 attrs, url, nullptr, &gl_info)); |
192 context_ = context_provider_ ? context_provider_->context3d() : nullptr; | |
193 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; | 190 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; |
194 | 191 |
195 if (!InitScene()) | 192 if (!InitScene()) |
196 return false; | 193 return false; |
197 | 194 |
198 layer_ = cc::TextureLayer::CreateForMailbox(this); | 195 layer_ = cc::TextureLayer::CreateForMailbox(this); |
199 web_layer_ = base::WrapUnique(new cc_blink::WebLayerImpl(layer_)); | 196 web_layer_ = base::WrapUnique(new cc_blink::WebLayerImpl(layer_)); |
200 container_->setWebLayer(web_layer_.get()); | 197 container_->setWebLayer(web_layer_.get()); |
201 if (re_request_touch_events_) { | 198 if (re_request_touch_events_) { |
202 container_->requestTouchEventType( | 199 container_->requestTouchEventType( |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 return kPluginPersistsMimeType; | 731 return kPluginPersistsMimeType; |
735 } | 732 } |
736 | 733 |
737 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 734 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
738 return mime_type == TestPlugin::MimeType() || | 735 return mime_type == TestPlugin::MimeType() || |
739 mime_type == PluginPersistsMimeType() || | 736 mime_type == PluginPersistsMimeType() || |
740 mime_type == CanCreateWithoutRendererMimeType(); | 737 mime_type == CanCreateWithoutRendererMimeType(); |
741 } | 738 } |
742 | 739 |
743 } // namespace test_runner | 740 } // namespace test_runner |
OLD | NEW |