hbbtv


Please do not edit this page. It is a template to be used by people applying as an Ubuntu developer.

Head over to https://wiki.ubuntu.com/YourName/YourDeveloperApplication instead and make use of this template.


I, <YOUR NAME>, apply for <universe-contributor|MOTU|core-dev|upload rights for package(s) <X>>.

Name

<YOUR NAME>

Launchpad Page

<link to your launchpad page>

Wiki Page

<link to your Wiki page>

Who I am

Tell us a bit about yourself.

My Ubuntu story

Tell us how and when you got involved, what you liked working on and what you could probably do better.

My involvement

Examples of my work / Things I'm proud of

Areas of work

Let us know what you worked on, with which development teams / developers you cooperated and how it worked out.

Things I could do better

Plans for the future

General

What I like least in Ubuntu

Please describe what you like least in Ubuntu and what thoughts do you have about fixing it.


Comments

If you'd like to comment, but are not the applicant or a sponsor, do it here. Don't forget to sign with @SIG@.


Endorsements

As a sponsor, just copy the template below, fill it out and add it to this section.


TEMPLATE

== <SPONSORS NAME> ==
=== General feedback ===
## Please fill us in on your shared experience. (How many packages did you sponsor? How would you judge the quality? How would you describe the improvements? Do you trust the applicant?)

=== Specific Experiences of working together ===
''Please add good examples of your work together, but also cases that could have handled better.''
=== Areas of Improvement ===


   1 /*
   2  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
   3  *
   4  * Redistribution and use in source and binary forms, with or without
   5  * modification, are permitted provided that the following conditions
   6  * are met:
   7  * 1. Redistributions of source code must retain the above copyright
   8  *    notice, this list of conditions and the following disclaimer.
   9  * 2. Redistributions in binary form must reproduce the above copyright
  10  *    notice, this list of conditions and the following disclaimer in the
  11  *    documentation and/or other materials provided with the distribution.
  12  *
  13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  24  */
  25 
  26 #ifndef Timer_h
  27 #define Timer_h
  28 
  29 #include <wtf/Noncopyable.h>
  30 #include <wtf/Threading.h>
  31 
  32 namespace WebCore {
  33 
  34 // Time intervals are all in seconds.
  35 
  36 class TimerHeapElement;
  37 
  38 class TimerBase : public Noncopyable {
  39 public:
  40     TimerBase();
  41     virtual ~TimerBase();
  42 
  43     void start(double nextFireInterval, double repeatInterval);
  44 
  45     void startRepeating(double repeatInterval) { start(repeatInterval, repeatInterval); }
  46     void startOneShot(double interval) { start(interval, 0); }
  47 
  48     void stop();
  49     bool isActive() const;
  50 
  51     double nextFireInterval() const;
  52     double repeatInterval() const { return m_repeatInterval; }
  53 
  54     void augmentRepeatInterval(double delta) { setNextFireTime(m_nextFireTime + delta); m_repeatInterval += delta; }
  55 
  56     static void fireTimersInNestedEventLoop();
  57 
  58 private:
  59     virtual void fired() = 0;
  60 
  61     void checkConsistency() const;
  62     void checkHeapIndex() const;
  63 
  64     void setNextFireTime(double);
  65 
  66     bool inHeap() const { return m_heapIndex != -1; }
  67 
  68     void heapDecreaseKey();
  69     void heapDelete();
  70     void heapDeleteMin();
  71     void heapIncreaseKey();
  72     void heapInsert();
  73     void heapPop();
  74     void heapPopMin();
  75 
  76     double m_nextFireTime; // 0 if inactive
  77     double m_repeatInterval; // 0 if not repeating
  78     int m_heapIndex; // -1 if not in heap
  79     unsigned m_heapInsertionOrder; // Used to keep order among equal-fire-time timers
  80 
  81 #ifndef NDEBUG
  82     ThreadIdentifier m_thread;
  83 #endif
  84 
  85     friend class TimerHeapElement;
  86     friend class ThreadTimers;
  87     friend bool operator<(const TimerHeapElement&, const TimerHeapElement&);
  88 };
  89 
  90 template <typename TimerFiredClass> class Timer : public TimerBase {
  91 public:
  92     typedef void (TimerFiredClass::*TimerFiredFunction)(Timer*);
  93 
  94     Timer(TimerFiredClass* o, TimerFiredFunction f)
  95         : m_object(o), m_function(f) { }
  96 
  97 private:
  98     virtual void fired() { (m_object->*m_function)(this); }
  99 
 100     TimerFiredClass* m_object;
 101     TimerFiredFunction m_function;
 102 };
 103 
 104 inline bool TimerBase::isActive() const
 105 {
 106     ASSERT(m_thread == currentThread());
 107     return m_nextFireTime;
 108 }
 109 
 110 }
 111 
 112 #endif
 113 

hbbtv (last edited 2010-11-23 08:37:03 by myzhanghongli)