| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "gpu/demos/framework/plugin.h" | 7 #include "gpu/demos/framework/plugin.h" |
| 8 #include "gpu/pgl/pgl.h" |
| 8 #include "webkit/glue/plugins/nphostapi.h" | 9 #include "webkit/glue/plugins/nphostapi.h" |
| 9 | 10 |
| 10 namespace { | 11 namespace { |
| 11 // AtExitManager is used by singleton classes to delete themselves when | 12 // AtExitManager is used by singleton classes to delete themselves when |
| 12 // the program terminates. There should be only one instance of this class | 13 // the program terminates. There should be only one instance of this class |
| 13 // per thread; | 14 // per thread; |
| 14 base::AtExitManager* g_at_exit_manager_; | 15 base::AtExitManager* g_at_exit_manager_; |
| 15 } // namespace | 16 } // namespace |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 plugin_funcs->urlnotify = gpu::demos::NPP_URLNotify; | 133 plugin_funcs->urlnotify = gpu::demos::NPP_URLNotify; |
| 133 plugin_funcs->getvalue = gpu::demos::NPP_GetValue; | 134 plugin_funcs->getvalue = gpu::demos::NPP_GetValue; |
| 134 plugin_funcs->setvalue = gpu::demos::NPP_SetValue; | 135 plugin_funcs->setvalue = gpu::demos::NPP_SetValue; |
| 135 | 136 |
| 136 return NPERR_NO_ERROR; | 137 return NPERR_NO_ERROR; |
| 137 } | 138 } |
| 138 | 139 |
| 139 NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs) { | 140 NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs) { |
| 140 g_at_exit_manager_ = new base::AtExitManager(); | 141 g_at_exit_manager_ = new base::AtExitManager(); |
| 141 gpu::demos::g_browser = browser_funcs; | 142 gpu::demos::g_browser = browser_funcs; |
| 143 pglInitialize(); |
| 142 return NPERR_NO_ERROR; | 144 return NPERR_NO_ERROR; |
| 143 } | 145 } |
| 144 | 146 |
| 145 void API_CALL NP_Shutdown() { | 147 void API_CALL NP_Shutdown() { |
| 148 pglTerminate(); |
| 146 delete g_at_exit_manager_; | 149 delete g_at_exit_manager_; |
| 147 } | 150 } |
| 148 } // extern "C" | 151 } // extern "C" |
| OLD | NEW |