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 "content/child/npapi/plugin_host.h" | 5 #include "content/child/npapi/plugin_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
55 // Returns true if Core Animation plugins are supported. This requires that the | 55 // Returns true if Core Animation plugins are supported. This requires that the |
56 // OS supports shared accelerated surfaces via IOSurface. This is true on Snow | 56 // OS supports shared accelerated surfaces via IOSurface. This is true on Snow |
57 // Leopard and higher. | 57 // Leopard and higher. |
58 static bool SupportsCoreAnimationPlugins() { | 58 static bool SupportsCoreAnimationPlugins() { |
59 if (CommandLine::ForCurrentProcess()->HasSwitch( | 59 if (CommandLine::ForCurrentProcess()->HasSwitch( |
60 switches::kDisableCoreAnimationPlugins)) | 60 switches::kDisableCoreAnimationPlugins)) |
61 return false; | 61 return false; |
62 // We also need to be running with desktop GL and not the software | 62 // We also need to be running with desktop GL and not the software |
63 // OSMesa renderer in order to share accelerated surfaces between | 63 // OSMesa renderer in order to share accelerated surfaces between |
64 // processes. | 64 // processes. Because on MacOS we lazy-initialize GLSurface in the |
65 gfx::GLImplementation implementation = gfx::GetGLImplementation(); | 65 // renderer process here, ensure we're not also initializing GL somewhere |
| 66 // else, and that we only do this once. |
| 67 static gfx::GLImplementation implementation = gfx::kGLImplementationNone; |
66 if (implementation == gfx::kGLImplementationNone) { | 68 if (implementation == gfx::kGLImplementationNone) { |
67 // Not initialized yet. | 69 // Not initialized yet. |
| 70 DCHECK_EQ(implementation, gfx::GetGLImplementation()) |
| 71 << "GL already initialized by someone else to: " |
| 72 << gfx::GetGLImplementation(); |
68 if (!gfx::GLSurface::InitializeOneOff()) { | 73 if (!gfx::GLSurface::InitializeOneOff()) { |
69 return false; | 74 return false; |
70 } | 75 } |
71 implementation = gfx::GetGLImplementation(); | 76 implementation = gfx::GetGLImplementation(); |
72 } | 77 } |
73 return (implementation == gfx::kGLImplementationDesktopGL); | 78 return (implementation == gfx::kGLImplementationDesktopGL); |
74 } | 79 } |
75 #endif | 80 #endif |
76 | 81 |
77 PluginHost::PluginHost() { | 82 PluginHost::PluginHost() { |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 } | 1105 } |
1101 | 1106 |
1102 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1107 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1103 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1108 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1104 if (plugin.get()) { | 1109 if (plugin.get()) { |
1105 plugin->URLRedirectResponse(!!allow, notify_data); | 1110 plugin->URLRedirectResponse(!!allow, notify_data); |
1106 } | 1111 } |
1107 } | 1112 } |
1108 | 1113 |
1109 } // extern "C" | 1114 } // extern "C" |
OLD | NEW |