Obey renderer-supplied quota in the browser.
[chromium-blink-merge.git] / ppapi / shared_impl / resource_var.cc
blob40d9e356b2838462dc06b08841bf8c441ba154e2
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
3 // found in the LICENSE file.
5 #include "ppapi/shared_impl/resource_var.h"
7 #include "ppapi/shared_impl/ppapi_globals.h"
8 #include "ppapi/shared_impl/var_tracker.h"
10 namespace ppapi {
12 int ResourceVar::GetPendingRendererHostId() const { return 0; }
14 int ResourceVar::GetPendingBrowserHostId() const { return 0; }
16 const IPC::Message* ResourceVar::GetCreationMessage() const { return NULL; }
18 ResourceVar* ResourceVar::AsResourceVar() { return this; }
20 PP_VarType ResourceVar::GetType() const { return PP_VARTYPE_RESOURCE; }
22 // static
23 ResourceVar* ResourceVar::FromPPVar(PP_Var var) {
24 if (var.type != PP_VARTYPE_RESOURCE)
25 return NULL;
26 scoped_refptr<Var> var_object(
27 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
28 if (!var_object.get())
29 return NULL;
30 return var_object->AsResourceVar();
33 ResourceVar::ResourceVar() {}
35 ResourceVar::~ResourceVar() {}
37 } // namespace ppapi