1// Copyright 2014 PDFium 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.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef FWL_THREAD_H_
8#define FWL_THREAD_H_
9
10// The FWL thread/app code contains three parallel inheritance hierarchies,
11// which reference each other via pointers as follows:
12//
13//                                           m_pImpl
14//      (nonesuch)              IFWL_Thread ----------> CFWL_ThreadImp
15//                                   |      <----------      |
16//                                   A       m_pIface        A
17//                                   |                       |
18//      (nonesuch)              IFWL_NoteThread         CFWL_NoteThreadImp
19//                                   |                       |
20//                                   A                       A
21//                m_pIface           |                       |
22//      CFWL_App --------------> IFWL_App                CFWL_AppImp
23//
24
25class CFWL_ThreadImp;
26class IFWL_NoteDriver;
27
28typedef struct _FWL_HTHREAD { void* pData; } * FWL_HTHREAD;
29
30class IFWL_Thread {
31 public:
32  // These call into polymorphic methods in the impl; no need to override.
33  void Release();
34  FWL_ERR Run(FWL_HTHREAD hThread);
35
36  CFWL_ThreadImp* GetImpl() const { return m_pImpl; }
37  void SetImpl(CFWL_ThreadImp* pImpl) { m_pImpl = pImpl; }
38
39 protected:
40  virtual ~IFWL_Thread() {}
41
42 private:
43  CFWL_ThreadImp* m_pImpl;
44};
45
46class IFWL_NoteThread : public IFWL_Thread {
47 public:
48  IFWL_NoteDriver* GetNoteDriver();
49};
50
51#endif  // FWL_THREAD_H_
52