0

move webkit/glue/fling_* to webkit/child

A little bit of rejiggering for Android JNI registration.

R=jam@chromium.org, jamesr@chromium.org
BUG=237249

Review URL: https://codereview.chromium.org/16424008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206148 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
scottmg@chromium.org
2013-06-13 20:02:21 +00:00
parent 9559f2c9c5
commit b52a42243d
18 changed files with 137 additions and 73 deletions

@ -300,6 +300,7 @@
'../ipc/ipc.gyp:test_support_ipc',
'../ppapi/ppapi_internal.gyp:ppapi_shared',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'../webkit/support/webkit_support.gyp:glue_child',
],
'export_dependent_settings': [
'renderer',

@ -18,6 +18,7 @@
#include "base/tracked_objects.h"
#include "content/app/android/app_jni_registrar.h"
#include "content/browser/android/browser_jni_registrar.h"
#include "content/child/android/child_jni_registrar.h"
#include "content/common/android/command_line.h"
#include "content/common/android/common_jni_registrar.h"
#include "content/public/common/content_switches.h"
@ -86,6 +87,9 @@ static jint LibraryLoaded(JNIEnv* env, jclass clazz,
if (!ui::shell_dialogs::RegisterJni(env))
return RESULT_CODE_FAILED_TO_REGISTER_JNI;
if (!content::android::RegisterChildJni(env))
return RESULT_CODE_FAILED_TO_REGISTER_JNI;
if (!content::android::RegisterCommonJni(env))
return RESULT_CODE_FAILED_TO_REGISTER_JNI;

@ -0,0 +1,27 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/child/android/child_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "webkit/child/fling_animator_impl_android.h"
namespace {
base::android::RegistrationMethod kContentRegisteredMethods[] = {
{ "FlingAnimator", webkit_glue::FlingAnimatorImpl::RegisterJni },
};
} // namespace
namespace content {
namespace android {
bool RegisterChildJni(JNIEnv* env) {
return RegisterNativeMethods(env, kContentRegisteredMethods,
arraysize(kContentRegisteredMethods));
}
} // namespace android
} // namespace content

@ -0,0 +1,21 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_CHILD_ANDROID_CHILD_JNI_REGISTRAR_H_
#define CONTENT_CHILD_ANDROID_CHILD_JNI_REGISTRAR_H_
#include <jni.h>
#include "content/common/content_export.h"
namespace content {
namespace android {
// Register all JNI bindings necessary for content child.
CONTENT_EXPORT bool RegisterChildJni(JNIEnv* env);
} // namespace android
} // namespace content
#endif // CONTENT_CHILD_ANDROID_CHILD_JNI_REGISTRAR_H_

@ -3,6 +3,7 @@ include_rules = [
"+media/audio",
"+media/base",
"-webkit/browser",
"-webkit/child",
"-webkit/renderer",
]

@ -10,14 +10,12 @@
#include "content/common/android/device_telephony_info.h"
#include "content/common/android/hash_set.h"
#include "content/common/android/trace_event_binding.h"
#include "webkit/glue/fling_animator_impl_android.h"
namespace {
base::android::RegistrationMethod kContentRegisteredMethods[] = {
{ "CommandLine", RegisterCommandLine },
{ "DeviceTelephonyInfo",
content::DeviceTelephonyInfo::RegisterDeviceTelephonyInfo },
{ "FlingAnimator", webkit_glue::FlingAnimatorImpl::RegisterJni },
{ "HashSet", content::RegisterHashSet },
{ "TraceEvent", RegisterTraceEvent },
};

@ -16,6 +16,8 @@
'../base/base.gyp:base',
],
'sources': [
'child/android/child_jni_registrar.cc',
'child/android/child_jni_registrar.h',
'child/child_histogram_message_filter.cc',
'child/child_histogram_message_filter.h',
'child/child_process.cc',
@ -96,7 +98,7 @@
'../third_party/WebKit/public/blink.gyp:blink',
'../third_party/npapi/npapi.gyp:npapi',
'../webkit/base/webkit_base.gyp:webkit_base',
'../webkit/support/webkit_support.gyp:glue',
'../webkit/support/webkit_support.gyp:glue_child',
],
}],
],

@ -159,6 +159,7 @@
],
}, { # OS != "ios"
'dependencies': [
'content_child',
'content_ppapi_plugin',
'content_utility',
'content_worker',
@ -551,6 +552,7 @@
}, { # OS != "ios"
'dependencies': [
'content_browser',
'content_child',
'content_gpu',
'content_plugin',
'content_renderer',
@ -750,6 +752,7 @@
'../ui/ui.gyp:shell_dialogs',
'../ui/ui.gyp:ui',
'../webkit/support/webkit_support.gyp:glue',
'../webkit/support/webkit_support.gyp:glue_child',
'../webkit/support/webkit_support.gyp:glue_renderer',
],
'include_dirs': [

3
webkit/child/DEPS Normal file

@ -0,0 +1,3 @@
include_rules = [
"+jni", # Needed for Android's java-generated bindings.
]

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/glue/fling_animator_impl_android.h"
#include "webkit/child/fling_animator_impl_android.h"
#include "base/android/jni_android.h"
#include "base/android/scoped_java_ref.h"

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#define WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#ifndef WEBKIT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
#define WEBKIT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_
#include "base/android/scoped_java_ref.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
@ -11,7 +11,7 @@
#include "third_party/WebKit/public/platform/WebSize.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point_f.h"
#include "webkit/glue/webkit_glue_export.h"
#include "webkit/child/webkit_child_export.h"
namespace WebKit {
class WebGestureCurveTarget;
@ -19,7 +19,7 @@ class WebGestureCurveTarget;
namespace webkit_glue {
class WEBKIT_GLUE_EXPORT FlingAnimatorImpl : public WebKit::WebGestureCurve {
class WEBKIT_CHILD_EXPORT FlingAnimatorImpl : public WebKit::WebGestureCurve {
public:
FlingAnimatorImpl();
virtual ~FlingAnimatorImpl();
@ -55,4 +55,4 @@ class WEBKIT_GLUE_EXPORT FlingAnimatorImpl : public WebKit::WebGestureCurve {
} // namespace webkit_glue
#endif // WEBKIT_GLUE_FLING_ANIMATOR_IMPL_ANDROID_H_
#endif // WEBKIT_CHILD_FLING_ANIMATOR_IMPL_ANDROID_H_

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/glue/fling_curve_configuration.h"
#include "webkit/child/fling_curve_configuration.h"
#include "base/logging.h"
#include "third_party/WebKit/public/platform/WebGestureCurve.h"

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_GLUE_FLINGCURVECONFIGURATION_H_
#define WEBKIT_GLUE_FLINGCURVECONFIGURATION_H_
#ifndef WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
#define WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
#include <vector>
@ -55,4 +55,4 @@ class FlingCurveConfiguration {
} // namespace webkit_glue
#endif // WEBKIT_GLUE_FLINGCURVECONFIGURATION_H_
#endif // WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_

@ -4,12 +4,42 @@
#include "webkit/child/webkitplatformsupport_child_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/child/fling_curve_configuration.h"
#if defined(OS_ANDROID)
#include "webkit/child/fling_animator_impl_android.h"
#endif
namespace webkit_glue {
WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() {
WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl()
: fling_curve_configuration_(new FlingCurveConfiguration) {}
WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {}
void WebKitPlatformSupportChildImpl::SetFlingCurveParameters(
const std::vector<float>& new_touchpad,
const std::vector<float>& new_touchscreen) {
fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen);
}
WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {
WebKit::WebGestureCurve*
WebKitPlatformSupportChildImpl::createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize& cumulative_scroll) {
#if defined(OS_ANDROID)
return FlingAnimatorImpl::CreateAndroidGestureCurve(velocity,
cumulative_scroll);
#endif
if (device_source == WebKit::WebGestureEvent::Touchscreen)
return fling_curve_configuration_->CreateForTouchScreen(velocity,
cumulative_scroll);
return fling_curve_configuration_->CreateForTouchPad(velocity,
cumulative_scroll);
}
} // namespace webkit_glue

@ -10,11 +10,24 @@
namespace webkit_glue {
class FlingCurveConfiguration;
class WEBKIT_CHILD_EXPORT WebKitPlatformSupportChildImpl :
public WebKitPlatformSupportImpl {
public:
WebKitPlatformSupportChildImpl();
virtual ~WebKitPlatformSupportChildImpl();
void SetFlingCurveParameters(
const std::vector<float>& new_touchpad,
const std::vector<float>& new_touchscreen);
virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize& cumulative_scroll) OVERRIDE;
scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_;
};
} // namespace webkit_glue

@ -63,21 +63,33 @@
'WEBKIT_CHILD_IMPLEMENTATION',
],
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit',
'<(DEPTH)/ui/ui.gyp:ui',
# TODO(scottmg): crbug.com/237249
'glue',
],
'include_dirs': [
# For JNI generated header.
'<(SHARED_INTERMEDIATE_DIR)/webkit',
],
'sources': [
'../child/fling_animator_impl_android.cc',
'../child/fling_animator_impl_android.h',
'../child/fling_curve_configuration.cc',
'../child/fling_curve_configuration.h',
'../child/webkit_child_export.h',
'../child/webkitplatformsupport_child_impl.cc',
'../child/webkitplatformsupport_child_impl.h',
],
'conditions': [
['component=="shared_library"', {
['OS=="android"', {
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
'overscroller_jni_headers',
],
}],
],
@ -220,10 +232,6 @@
'sources': [
'cursor_utils.cc',
'cursor_utils.h',
'fling_curve_configuration.cc',
'fling_curve_configuration.h',
'fling_animator_impl_android.cc',
'fling_animator_impl_android.h',
'ftp_directory_listing_response_delegate.cc',
'ftp_directory_listing_response_delegate.h',
'glue_serialize_deprecated.cc',
@ -348,12 +356,6 @@
}],
],
}],
['OS=="android"', {
'dependencies': [
'overscroller_jni_headers',
],
}],
],
},
],

@ -31,6 +31,9 @@
#include "net/base/data_url.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/public/platform/WebCookie.h"
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebDiscardableMemory.h"
@ -39,13 +42,9 @@
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "ui/base/layout.h"
#include "webkit/base/file_path_string_conversions.h"
#include "webkit/common/user_agent/user_agent.h"
#include "webkit/glue/fling_curve_configuration.h"
#include "webkit/glue/touch_fling_gesture_curve.h"
#include "webkit/glue/web_discardable_memory_impl.h"
#include "webkit/glue/webkit_glue.h"
@ -57,10 +56,6 @@
#include "webkit/plugins/webplugininfo.h"
#include "webkit/renderer/media/audio_decoder.h"
#if defined(OS_ANDROID)
#include "webkit/glue/fling_animator_impl_android.h"
#endif
using WebKit::WebAudioBus;
using WebKit::WebCookie;
using WebKit::WebData;
@ -373,18 +368,11 @@ WebKitPlatformSupportImpl::WebKitPlatformSupportImpl()
shared_timer_fire_time_(0.0),
shared_timer_fire_time_was_set_while_suspended_(false),
shared_timer_suspended_(0),
current_thread_slot_(&DestroyCurrentThread),
fling_curve_configuration_(new FlingCurveConfiguration) {}
current_thread_slot_(&DestroyCurrentThread) {}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
}
void WebKitPlatformSupportImpl::SetFlingCurveParameters(
const std::vector<float>& new_touchpad,
const std::vector<float>& new_touchscreen) {
fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen);
}
WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() {
return &native_theme_engine_;
}
@ -986,24 +974,6 @@ void WebKitPlatformSupportImpl::didStopWorkerRunLoop(
worker_task_runner->OnWorkerRunLoopStopped(runLoop);
}
WebKit::WebGestureCurve* WebKitPlatformSupportImpl::createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize& cumulative_scroll) {
#if defined(OS_ANDROID)
return FlingAnimatorImpl::CreateAndroidGestureCurve(velocity,
cumulative_scroll);
#endif
if (device_source == WebKit::WebGestureEvent::Touchscreen)
return fling_curve_configuration_->CreateForTouchScreen(velocity,
cumulative_scroll);
return fling_curve_configuration_->CreateForTouchPad(velocity,
cumulative_scroll);
}
WebKit::WebDiscardableMemory*
WebKitPlatformSupportImpl::allocateAndLockDiscardableMemory(size_t bytes) {
if (!base::DiscardableMemory::Supported())

@ -42,7 +42,6 @@ class WebSocketStreamHandle;
namespace webkit_glue {
class FlingCurveConfiguration;
class WebSocketStreamHandleDelegate;
class WebSocketStreamHandleBridge;
@ -52,10 +51,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
WebKitPlatformSupportImpl();
virtual ~WebKitPlatformSupportImpl();
void SetFlingCurveParameters(
const std::vector<float>& new_touchpad,
const std::vector<float>& new_touchscreen);
// Platform methods (partial implementation):
virtual WebKit::WebThemeEngine* themeEngine();
virtual WebKit::WebFallbackThemeEngine* fallbackThemeEngine();
@ -169,11 +164,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
virtual void didStopWorkerRunLoop(
const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE;
virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
int device_source,
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize& cumulative_scroll) OVERRIDE;
#if defined(OS_ANDROID)
virtual webkit_media::WebAudioMediaCodecRunner
GetWebAudioMediaCodecRunner();
@ -194,7 +184,6 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
WebThemeEngineImpl native_theme_engine_;
WebFallbackThemeEngineImpl fallback_theme_engine_;
base::ThreadLocalStorage::Slot current_thread_slot_;
scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_;
};
} // namespace webkit_glue