FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
virtual void FB::JSAPIImpl::pushZone ( const SecurityZone securityLevel)

Pushes a new security level and locks a mutex (for every Push there must be a Pop!)

This should be used to temporarily set the security zone of the API object. Note that this also locks a mutex to ensure that access to members under a non-default security level is serialized. Do not ever leave an unmatched push (a push with no pop after it). For safety, use the helper FB::scoped_zonelock:

// In the constructor
// Register protected members
FB::scoped_zonelock _l(this, SecurityScope_Protected);
registerMethod("start", make_method(this, &MyPluginAPI::start));
} // Zone automatically popped off
// Register private members
FB::scoped_zonelock _l(this, SecurityScope_Protected);
registerMethod("getDirectoryListing", make_method(this, &MyPluginAPI::getDirectoryListing));
} // Zone automatically popped off
securityLevelconst SecurityZone & Zone id to push on the stack
See Also

Reimplemented from FB::JSAPI.

Definition at line 176 of file JSAPIImpl.h.

177  {
178  m_zoneMutex.lock();
179  m_zoneStack.push_back(securityLevel);
180  }