gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / ppapi / cpp / extensions / event_base.cc
blob210b213d0e35353bcd451622fd3f737a8758132a
1 // Copyright (c) 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/cpp/extensions/event_base.h"
7 #include "ppapi/cpp/extensions/dev/events_dev.h"
9 namespace pp {
10 namespace ext {
11 namespace internal {
13 GenericEventBase::GenericEventBase(
14 const InstanceHandle& instance,
15 const PP_Ext_EventListener& pp_listener)
16 : instance_(instance),
17 listener_id_(0),
18 pp_listener_(pp_listener) {
21 GenericEventBase::~GenericEventBase() {
22 StopListening();
25 bool GenericEventBase::StartListening() {
26 if (IsListening())
27 return true;
29 listener_id_ = events::Events_Dev::AddListener(instance_.pp_instance(),
30 pp_listener_);
31 return IsListening();
34 void GenericEventBase::StopListening() {
35 if (!IsListening())
36 return;
38 events::Events_Dev::RemoveListener(instance_.pp_instance(), listener_id_);
39 listener_id_ = 0;
42 } // namespace internal
43 } // namespace ext
44 } // namespace pp