mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
![Doug Thayer](/assets/img/avatar_default.png)
See the design doc[1] for further info. We would like to redesign the places observer system to be more performant and more friendly to consume. WebIDL was recommended as it simplifies creating simple dictionary payloads while allowing dynamic typing with `any`. There were some difficulties with WebIDL though, most of which revolved around allowing consumers to be weakly referenced, from both C++ and JS. The simplest solution I could come up with was to create a simple native interface for the C++ case, and a WebIDL wrapper for a JS callback in the JS case. Suggestions for simpler alternatives are very welcome though. [1] https://docs.google.com/document/d/1G45vfd6RXFXwNz7i4FV40lDCU0ao-JX_bZdgJV4tLjk/edit?usp=sharing MozReview-Commit-ID: ACnAEfa5WxO --HG-- extra : rebase_source : 0e4d66fb7eab68c14fad10e3c5876bc491452e22
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_image_INativePlacesEventCallback_h
|
|
#define mozilla_image_INativePlacesEventCallback_h
|
|
|
|
#include "mozilla/dom/PlacesObserversBinding.h"
|
|
#include "mozilla/WeakPtr.h"
|
|
#include "nsISupports.h"
|
|
#include "nsTArray.h"
|
|
|
|
namespace mozilla {
|
|
namespace places {
|
|
|
|
class INativePlacesEventCallback : public SupportsWeakPtr<INativePlacesEventCallback>
|
|
{
|
|
public:
|
|
typedef dom::Sequence<OwningNonNull<dom::PlacesEvent>> PlacesEventSequence;
|
|
|
|
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(INativePlacesEventCallback)
|
|
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
|
|
|
virtual void HandlePlacesEvent(const PlacesEventSequence& aEvents) = 0;
|
|
|
|
protected:
|
|
virtual ~INativePlacesEventCallback() { }
|
|
};
|
|
|
|
} // namespace places
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_image_INativePlacesEventCallback_h
|