1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "fake_ppapi/fake_messaging_interface.h" 6 7#include "fake_ppapi/fake_var_manager.h" 8 9FakeMessagingInterface::FakeMessagingInterface( 10 FakeVarManager* manager, nacl_io::VarInterface* var_interface) 11 : manager_(manager), var_interface_(var_interface) {} 12 13FakeMessagingInterface::~FakeMessagingInterface() { 14 for (std::vector<PP_Var>::iterator it = messages.begin(); 15 it != messages.end(); ++it) { 16 manager_->Release(*it); 17 } 18 messages.clear(); 19} 20 21void FakeMessagingInterface::PostMessage(PP_Instance instance, 22 PP_Var message) { 23 manager_->AddRef(message); 24 messages.push_back(message); 25} 26