Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: content/shell/renderer/test_runner/test_plugin.cc

Issue 1142463002: Plumb dependencies on content from test plugin through the delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/shell/renderer/test_runner/test_plugin.h" 5 #include "content/shell/renderer/test_runner/test_plugin.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "cc/resources/shared_bitmap_manager.h" 12 #include "cc/resources/shared_bitmap_manager.h"
13 #include "content/public/renderer/render_thread.h"
14 #include "content/shell/renderer/test_runner/web_test_delegate.h" 13 #include "content/shell/renderer/test_runner/web_test_delegate.h"
15 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 15 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
18 #include "third_party/WebKit/public/platform/Platform.h" 17 #include "third_party/WebKit/public/platform/Platform.h"
19 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" 18 #include "third_party/WebKit/public/platform/WebCompositorSupport.h"
20 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 19 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
21 #include "third_party/WebKit/public/platform/WebThread.h" 20 #include "third_party/WebKit/public/platform/WebThread.h"
22 #include "third_party/WebKit/public/platform/WebTraceLocation.h" 21 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
23 #include "third_party/WebKit/public/web/WebFrame.h" 22 #include "third_party/WebKit/public/web/WebFrame.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 215
217 bool TestPlugin::initialize(blink::WebPluginContainer* container) { 216 bool TestPlugin::initialize(blink::WebPluginContainer* container) {
218 blink::WebGraphicsContext3D::Attributes attrs; 217 blink::WebGraphicsContext3D::Attributes attrs;
219 context_ = 218 context_ =
220 blink::Platform::current()->createOffscreenGraphicsContext3D(attrs); 219 blink::Platform::current()->createOffscreenGraphicsContext3D(attrs);
221 220
222 if (!InitScene()) 221 if (!InitScene())
223 return false; 222 return false;
224 223
225 layer_ = cc::TextureLayer::CreateForMailbox(this); 224 layer_ = cc::TextureLayer::CreateForMailbox(this);
226 web_layer_ = make_scoped_ptr(InstantiateWebLayer(layer_)); 225 web_layer_ = make_scoped_ptr(delegate_->InstantiateWebLayer(layer_));
227 container_ = container; 226 container_ = container;
228 container_->setWebLayer(web_layer_.get()); 227 container_->setWebLayer(web_layer_.get());
229 if (re_request_touch_events_) { 228 if (re_request_touch_events_) {
230 container_->requestTouchEventType( 229 container_->requestTouchEventType(
231 blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse); 230 blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse);
232 container_->requestTouchEventType( 231 container_->requestTouchEventType(
233 blink::WebPluginContainer::TouchEventRequestTypeRaw); 232 blink::WebPluginContainer::TouchEventRequestTypeRaw);
234 } 233 }
235 container_->requestTouchEventType(touch_event_request_); 234 container_->requestTouchEventType(touch_event_request_);
236 container_->setWantsWheelEvents(true); 235 container_->setWantsWheelEvents(true);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DrawSceneGL(); 304 DrawSceneGL();
306 305
307 gpu::Mailbox mailbox; 306 gpu::Mailbox mailbox;
308 context_->genMailboxCHROMIUM(mailbox.name); 307 context_->genMailboxCHROMIUM(mailbox.name);
309 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 308 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
310 context_->flush(); 309 context_->flush();
311 uint32 sync_point = context_->insertSyncPoint(); 310 uint32 sync_point = context_->insertSyncPoint();
312 texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 311 texture_mailbox_ = cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
313 } else { 312 } else {
314 scoped_ptr<cc::SharedBitmap> bitmap = 313 scoped_ptr<cc::SharedBitmap> bitmap =
315 RenderThread::Get()->GetSharedBitmapManager()->AllocateSharedBitmap( 314 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap(
316 gfx::Rect(rect_).size()); 315 gfx::Rect(rect_).size());
317 if (!bitmap) { 316 if (!bitmap) {
318 texture_mailbox_ = cc::TextureMailbox(); 317 texture_mailbox_ = cc::TextureMailbox();
319 } else { 318 } else {
320 DrawSceneSoftware(bitmap->pixels()); 319 DrawSceneSoftware(bitmap->pixels());
321 texture_mailbox_ = cc::TextureMailbox( 320 texture_mailbox_ = cc::TextureMailbox(
322 bitmap.get(), gfx::Size(rect_.width, rect_.height)); 321 bitmap.get(), gfx::Size(rect_.width, rect_.height));
323 shared_bitmap_ = bitmap.Pass(); 322 shared_bitmap_ = bitmap.Pass();
324 } 323 }
325 } 324 }
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 return kPluginPersistsMimeType; 773 return kPluginPersistsMimeType;
775 } 774 }
776 775
777 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { 776 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) {
778 return mime_type == TestPlugin::MimeType() || 777 return mime_type == TestPlugin::MimeType() ||
779 mime_type == PluginPersistsMimeType() || 778 mime_type == PluginPersistsMimeType() ||
780 mime_type == CanCreateWithoutRendererMimeType(); 779 mime_type == CanCreateWithoutRendererMimeType();
781 } 780 }
782 781
783 } // namespace content 782 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_plugin.h ('k') | content/shell/renderer/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698