Hello andreip,

I'd like you to do a code review.  Please execute
        g4 diff -c 9465156

or point your web browser to
        http://mondrian/9465156

to review the following code:

Change 9465156 by stevebl...@steveblock-gears2 on 2008/12/18 14:44:09 *pending*

        Changes to factory required by Opera. Mailed on bahalf of Opera.
        
        R=andreip
        [email protected],[email protected]
        DELTA=24  (24 added, 0 deleted, 0 changed)
        OCL=9465156

Affected files ...

... //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#21 edit
... //depot/googleclient/gears/opensource/gears/factory/factory_np.cc#3 edit

24 delta lines: 24 added, 0 deleted, 0 changed

Also consider running:
        g4 lint -c 9465156

which verifies that the changelist doesn't introduce new style violations.

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [email protected].
Change 9465156 by stevebl...@steveblock-gears2 on 2008/12/18 14:44:09 *pending*

        Changes to factory required by Opera. Mailed on bahalf of Opera.

Affected files ...

... //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#21 edit
... //depot/googleclient/gears/opensource/gears/factory/factory_np.cc#3 edit

==== //depot/googleclient/gears/opensource/gears/factory/factory_impl.cc#21 - 
c:\MyDocs\Gears2/googleclient/gears/opensource/gears/factory/factory_impl.cc 
====
# action=edit type=text
--- googleclient/gears/opensource/gears/factory/factory_impl.cc 2008-12-17 
12:17:37.000000000 +0000
+++ googleclient/gears/opensource/gears/factory/factory_impl.cc 2008-12-18 
15:17:40.000000000 +0000
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "gears/base/common/base_class.h"
+#include "gears/base/common/js_runner.h"
 #include "gears/base/common/detect_version_collision.h"
 #include "gears/base/common/string16.h"
 #ifdef OS_WINCE
@@ -76,6 +77,10 @@
 #ifdef USING_CCTESTS
 #include "gears/cctests/test.h"
 #endif
+#ifdef BROWSER_OPERA 
+#include "gears/base/opera/opera_utils.h"
+#include "third_party/opera/opera_callback_api.h"
+#endif
 
 DECLARE_DISPATCHER(GearsFactoryImpl);
 
@@ -114,7 +119,7 @@
     if (!EnvIsWorker()) {
       MaybeNotifyUserOfVersionCollision();  // only notifies once per process
     }
-    
+
     const char16 *error_text = GetVersionCollisionErrorString();
     if (error_text) {
       context->SetException(error_text);
@@ -171,7 +176,7 @@
   // Do case-sensitive comparisons, which are always better in APIs. They make
   // code consistent across callers, and they are easier to support over time.
   scoped_refptr<ModuleImplBaseClass> object;
-  
+
   if (module_name == STRING16(L"beta.database")) {
     CreateModule<GearsDatabase>(module_environment_.get(), context, &object);
   } else if (module_name == STRING16(L"beta.desktop")) {
@@ -196,8 +201,26 @@
   } else if (module_name == STRING16(L"beta.timer")) {
     CreateModule<GearsTimer>(module_environment_.get(), context, &object);
   } else if (module_name == STRING16(L"beta.workerpool")) {
+#ifdef BROWSER_OPERA
+       // Opera uses its own implementation of the worker threads so they have
+       // to be created using a different method than the gears internal ones
+       NPObject* wp = OperaUtils::GetBrowserApiForGears()->
+         CreateWorkerPool(context->js_context(),
+                                          
NPVARIANT_TO_OBJECT(GetWrapper()->GetWrapperToken()));
+       if (!wp)
+         context->SetException(STRING16(L"Internal error."));
+       else {
+         scoped_ptr<JsObject> wpo;
+         NPVariant v;
+         OBJECT_TO_NPVARIANT(wp, v);
+         JsTokenToObject_NoCoerce(v,
+                                                          
context->js_context(), as_out_parameter(wpo));
+         context->SetReturnValue(JSPARAM_OBJECT, wpo.get());
+       }
+#else  // BROWSER_OPERA
     CreateModule<GearsWorkerPool>(module_environment_.get(),
                                   context, &object);
+#endif  // BROWSER_OPERA
 #ifdef OFFICIAL_BUILD
   // The BlobBuilder, Canvas, Console, Database2, Image and Media APIs have not
   // been finalized for official builds.
@@ -258,9 +281,9 @@
 void GearsFactoryImpl::GetPermission(JsCallContext *context) {
   scoped_ptr<PermissionsDialog::CustomContent> custom_content(
       PermissionsDialog::CreateCustomContent(context));
- 
+
   if (!custom_content.get()) { return; }
- 
+
   bool has_permission = GetPermissionsManager()->AcquirePermission(
       PermissionsDB::PERMISSION_LOCAL_DATA,
       custom_content.get());
==== //depot/googleclient/gears/opensource/gears/factory/factory_np.cc#3 - 
c:\MyDocs\Gears2/googleclient/gears/opensource/gears/factory/factory_np.cc ====
# action=edit type=text
--- googleclient/gears/opensource/gears/factory/factory_np.cc   2008-11-10 
14:29:58.000000000 +0000
+++ googleclient/gears/opensource/gears/factory/factory_np.cc   2008-12-18 
14:44:12.000000000 +0000
@@ -41,6 +41,7 @@
     factory_impl->InitModuleEnvironment(module_environment.get());
     factory_wrapper->Init(factory_impl,
                           new Dispatcher<GearsFactoryImpl>(factory_impl));
+    factory_impl->SetJsWrapper(factory_wrapper.get());
   }
 
   return factory_wrapper.release();

Reply via email to