| 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 "content/shell/renderer/test_runner/TestPlugin.h" | 5 #include "content/shell/renderer/test_runner/TestPlugin.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" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 185 } |
| 186 | 186 |
| 187 TestPlugin::~TestPlugin() | 187 TestPlugin::~TestPlugin() |
| 188 { | 188 { |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool TestPlugin::initialize(WebPluginContainer* container) | 191 bool TestPlugin::initialize(WebPluginContainer* container) |
| 192 { | 192 { |
| 193 WebGraphicsContext3D::Attributes attrs; | 193 WebGraphicsContext3D::Attributes attrs; |
| 194 m_context = Platform::current()->createOffscreenGraphicsContext3D(attrs); | 194 m_context = Platform::current()->createOffscreenGraphicsContext3D(attrs); |
| 195 if (m_context && !m_context->makeContextCurrent()) { | |
| 196 delete m_context; | |
| 197 m_context = 0; | |
| 198 } | |
| 199 | 195 |
| 200 if (!initScene()) | 196 if (!initScene()) |
| 201 return false; | 197 return false; |
| 202 | 198 |
| 203 m_layer = cc::TextureLayer::CreateForMailbox(this); | 199 m_layer = cc::TextureLayer::CreateForMailbox(this); |
| 204 m_webLayer = make_scoped_ptr(InstantiateWebLayer(m_layer)); | 200 m_webLayer = make_scoped_ptr(InstantiateWebLayer(m_layer)); |
| 205 m_container = container; | 201 m_container = container; |
| 206 m_container->setWebLayer(m_webLayer.get()); | 202 m_container->setWebLayer(m_webLayer.get()); |
| 207 if (m_reRequestTouchEvents) { | 203 if (m_reRequestTouchEvents) { |
| 208 m_container->requestTouchEventType(WebPluginContainer::TouchEventRequest
TypeSynthesizedMouse); | 204 m_container->requestTouchEventType(WebPluginContainer::TouchEventRequest
TypeSynthesizedMouse); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 674 } |
| 679 | 675 |
| 680 bool TestPlugin::isSupportedMimeType(const WebString& mimeType) | 676 bool TestPlugin::isSupportedMimeType(const WebString& mimeType) |
| 681 { | 677 { |
| 682 return mimeType == TestPlugin::mimeType() | 678 return mimeType == TestPlugin::mimeType() |
| 683 || mimeType == pluginPersistsMimeType() | 679 || mimeType == pluginPersistsMimeType() |
| 684 || mimeType == canCreateWithoutRendererMimeType(); | 680 || mimeType == canCreateWithoutRendererMimeType(); |
| 685 } | 681 } |
| 686 | 682 |
| 687 } // namespace content | 683 } // namespace content |
| OLD | NEW |