| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/plugin_var_serialization_rules.h" | 5 #include "ppapi/proxy/plugin_var_serialization_rules.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_globals.h" | 9 #include "ppapi/proxy/plugin_globals.h" |
| 10 #include "ppapi/proxy/plugin_resource_tracker.h" | 10 #include "ppapi/proxy/plugin_resource_tracker.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Browser calls BeginSendPassRef 3 2 0 1 | 78 // Browser calls BeginSendPassRef 3 2 0 1 |
| 79 // Plugin calls ReceivePassRef 4 1 1 1 | 79 // Plugin calls ReceivePassRef 4 1 1 1 |
| 80 // Browser calls EndSendPassRef 4 1 1 1 | 80 // Browser calls EndSendPassRef 4 1 1 1 |
| 81 // | 81 // |
| 82 // In example 1 before the send, the plugin has 3 refs which are represented | 82 // In example 1 before the send, the plugin has 3 refs which are represented |
| 83 // as one ref in the browser (since the plugin only tells the browser when | 83 // as one ref in the browser (since the plugin only tells the browser when |
| 84 // it's refcount goes from 1 -> 0). The initial state is that the browser | 84 // it's refcount goes from 1 -> 0). The initial state is that the browser |
| 85 // plugin code started to return a value, which means it gets another ref | 85 // plugin code started to return a value, which means it gets another ref |
| 86 // on behalf of the caller. This needs to be transferred to the plugin and | 86 // on behalf of the caller. This needs to be transferred to the plugin and |
| 87 // folded in to its set of refs it maintains (with one ref representing all | 87 // folded in to its set of refs it maintains (with one ref representing all |
| 88 // fo them in the browser). | 88 // of them in the browser). |
| 89 if (var.type == PP_VARTYPE_OBJECT) { | 89 if (var.type == PP_VARTYPE_OBJECT) { |
| 90 DCHECK(dispatcher->IsPlugin()); | 90 DCHECK(dispatcher->IsPlugin()); |
| 91 return var_tracker_->ReceiveObjectPassRef( | 91 return var_tracker_->ReceiveObjectPassRef( |
| 92 var, static_cast<PluginDispatcher*>(dispatcher)); | 92 var, static_cast<PluginDispatcher*>(dispatcher)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Other types are unchanged. | 95 // Other types are unchanged. |
| 96 return var; | 96 return var; |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 var_tracker_->ReleaseVar(var); | 140 var_tracker_->ReleaseVar(var); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { | 144 void PluginVarSerializationRules::ReleaseObjectRef(const PP_Var& var) { |
| 145 var_tracker_->ReleaseVar(var); | 145 var_tracker_->ReleaseVar(var); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace proxy | 148 } // namespace proxy |
| 149 } // namespace ppapi | 149 } // namespace ppapi |
| OLD | NEW |