author Rob Wu <rob@robwu.nl>
Sat, 24 Sep 2016 11:16:32 +0200
changeset 320058 a41f871e2d1b37754bbd1001c36c075511b49342
parent 309019 2605dceca7b26e11f3a2c546cf5aaea7d0fb9385
permissions -rw-r--r--
Bug 1299411 - Decouple Port implementation from API r=aswan Decoupled the API from the implementation. From now on it is possible to create Port instances without generating an API. This allows us to internally use Ports to pass around messages with minimal overhead (in the form of unnecessary clones of messages). This will be used by native messaging. This commit has no behavioral change, it is mostly moving around some code and storing the internal message listener in a set. MozReview-Commit-ID: 4h0LNJvTH9R

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 nsDeviceContextSpecProxy_h
#define nsDeviceContextSpecProxy_h

#include "nsIDeviceContextSpec.h"
#include "nsCOMPtr.h"

class nsIPrintSession;

namespace mozilla {
namespace gfx {
class DrawEventRecorderMemory;

namespace layout {
class RemotePrintJobChild;

class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec

  NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPrintSettings,
                 bool aIsPrintPreview) final;

  virtual already_AddRefed<PrintTarget> MakePrintTarget() final;

  NS_IMETHOD GetDrawEventRecorder(mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) final;

  float GetDPI() final;

  float GetPrintingScale() final;

  NS_IMETHOD BeginDocument(const nsAString& aTitle,
                           const nsAString& aPrintToFileName,
                           int32_t aStartPage, int32_t aEndPage) final;

  NS_IMETHOD EndDocument() final;

  NS_IMETHOD AbortDocument() final;

  NS_IMETHOD BeginPage() final;

  NS_IMETHOD EndPage() final;

  ~nsDeviceContextSpecProxy() {}

  nsCOMPtr<nsIPrintSettings> mPrintSettings;
  nsCOMPtr<nsIPrintSession> mPrintSession;
  nsCOMPtr<nsIDeviceContextSpec> mRealDeviceContextSpec;
  RefPtr<mozilla::layout::RemotePrintJobChild> mRemotePrintJob;
  RefPtr<mozilla::gfx::DrawEventRecorderMemory> mRecorder;

#endif // nsDeviceContextSpecProxy_h