Closed Bug 1241769 Opened 8 years ago Closed 8 years ago

Use Singleton pattern to nsScreenManagerGonk

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
Tracking Status
firefox47 --- fixed

People

(Reporter: sotaro, Assigned: sotaro)

Details

Attachments

(1 file, 1 obsolete file)

It seems nice to apply Singleton pattern to nsScreenManagerGonk that is used like AudioManager.
Assignee: nobody → sotaro.ikeda.g
Attachment #8710878 - Flags: review?(mwu)
Comment on attachment 8710878 [details] [diff] [review]
patch - Use Singleton pattern to nsScreenManagerGonk

Review of attachment 8710878 [details] [diff] [review]:
-----------------------------------------------------------------

It does make more sense to do it this way, though a bit unfortunate that more code is required and we can't reuse the do_GetService logic.

::: widget/gonk/nsScreenManagerGonk.cpp
@@ +766,4 @@
>  /* static */ already_AddRefed<nsScreenManagerGonk>
>  nsScreenManagerGonk::GetInstance()
>  {
> +  MOZ_ASSERT(NS_IsMainThread());

This file is 4 space indent, so this function should be too.

@@ +767,5 @@
>  nsScreenManagerGonk::GetInstance()
>  {
> +  MOZ_ASSERT(NS_IsMainThread());
> +
> +  // Avoid createing nsScreenManagerGonk from content process.

nit: s/createing/creating/

@@ +772,5 @@
> +  if (!XRE_IsParentProcess()) {
> +    MOZ_CRASH("Non-chrome processes should not get here.");
> +  }
> +
> +  // Avoid createing multiple nsScreenManagerGonk instance inside main process.

nit: s/createing/creating/
Attachment #8710878 - Flags: review?(mwu) → review+
Apply the comment. Carry "r=mwu".
Attachment #8710878 - Attachment is obsolete: true
Attachment #8715117 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/5665bf204fe3
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: